Skip to content

Test: target REQUEST_COOKIES - 059 #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions config_tests/CONF_059_TARGET_REQUEST_COOKIES.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
target: REQUEST_COOKIES
rulefile: MRTS_059_REQUEST_COOKIES.conf
testfile: MRTS_059_REQUEST_COOKIES.yaml
templates:
- SecRule for TARGETS
colkey:
- - ''
- - cookie1
- - cookie1
- cookie2
- - /^cookie_.*$/
operator:
- '@contains'
oparg:
- attack
phase:
- 1
- 2
- 3
- 4
testdata:
phase_methods:
1: get
2: post
3: post
4: post
targets:
- target: ''
test:
data: null
input:
headers:
- name: Cookie
value: foo=attack
- target: cookie1
test:
data: null
input:
headers:
- name: Cookie
value: cookie1=attack
- target: cookie1
test:
data: null
input:
headers:
- name: Cookie
value: cookie1=attack;cookie2=hello
- target: cookie2
test:
data: null
input:
headers:
- name: Cookie
value: cookie2=attack
- target: cookie2
test:
data: null
input:
headers:
- name: Cookie
value: cookie1=hello;cookie2=attack
- target: /^cookie_.*$/
test:
data: null
input:
headers:
- name: Cookie
value: cookie_foo=attack
- target: /^cookie_.*$/
test:
data: null
input:
headers:
- name: Cookie
value: cookie_bar=hello;cookie_foo=attack;cookie_foobar=world
144 changes: 144 additions & 0 deletions generated/rules/MRTS_059_REQUEST_COOKIES.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
SecRule REQUEST_COOKIES "@contains attack" \
"id:100092,\
phase:1,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES "@contains attack" \
"id:100093,\
phase:2,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES "@contains attack" \
"id:100094,\
phase:3,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES "@contains attack" \
"id:100095,\
phase:4,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
"id:100096,\
phase:1,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
"id:100097,\
phase:2,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
"id:100098,\
phase:3,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
"id:100099,\
phase:4,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
"id:100100,\
phase:1,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
"id:100101,\
phase:2,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
"id:100102,\
phase:3,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
"id:100103,\
phase:4,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
"id:100104,\
phase:1,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
"id:100105,\
phase:2,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
"id:100106,\
phase:3,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
ver:'MRTS/0.1'"

SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
"id:100107,\
phase:4,\
deny,\
t:none,\
log,\
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
ver:'MRTS/0.1'"

6 changes: 3 additions & 3 deletions generated/rules/MRTS_110_XML.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SecRule XML:/* "@beginsWith foo" \
"id:100092,\
"id:100108,\
phase:2,\
deny,\
t:none,\
Expand All @@ -8,7 +8,7 @@ SecRule XML:/* "@beginsWith foo" \
ver:'MRTS/0.1'"

SecRule XML:/* "@beginsWith foo" \
"id:100093,\
"id:100109,\
phase:3,\
deny,\
t:none,\
Expand All @@ -17,7 +17,7 @@ SecRule XML:/* "@beginsWith foo" \
ver:'MRTS/0.1'"

SecRule XML:/* "@beginsWith foo" \
"id:100094,\
"id:100110,\
phase:4,\
deny,\
t:none,\
Expand Down
Loading