Skip to content

Commit 6505335

Browse files
committed
Test target REQUEST_COOKIES_NAMES
Signed-off-by: Sebitosh <[email protected]>
1 parent 82bcf68 commit 6505335

21 files changed

+1591
-15
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
SecRule REQUEST_COOKIES "@contains attack" \
2+
"id:100116,\
3+
phase:1,\
4+
deny,\
5+
t:none,\
6+
log,\
7+
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
8+
ver:'MRTS/0.1'"
9+
10+
SecRule REQUEST_COOKIES "@contains attack" \
11+
"id:100117,\
12+
phase:2,\
13+
deny,\
14+
t:none,\
15+
log,\
16+
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
17+
ver:'MRTS/0.1'"
18+
19+
SecRule REQUEST_COOKIES "@contains attack" \
20+
"id:100118,\
21+
phase:3,\
22+
deny,\
23+
t:none,\
24+
log,\
25+
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
26+
ver:'MRTS/0.1'"
27+
28+
SecRule REQUEST_COOKIES "@contains attack" \
29+
"id:100119,\
30+
phase:4,\
31+
deny,\
32+
t:none,\
33+
log,\
34+
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
35+
ver:'MRTS/0.1'"
36+
37+
SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
38+
"id:100120,\
39+
phase:1,\
40+
deny,\
41+
t:none,\
42+
log,\
43+
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
44+
ver:'MRTS/0.1'"
45+
46+
SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
47+
"id:100121,\
48+
phase:2,\
49+
deny,\
50+
t:none,\
51+
log,\
52+
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
53+
ver:'MRTS/0.1'"
54+
55+
SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
56+
"id:100122,\
57+
phase:3,\
58+
deny,\
59+
t:none,\
60+
log,\
61+
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
62+
ver:'MRTS/0.1'"
63+
64+
SecRule REQUEST_COOKIES:cookie1 "@contains attack" \
65+
"id:100123,\
66+
phase:4,\
67+
deny,\
68+
t:none,\
69+
log,\
70+
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
71+
ver:'MRTS/0.1'"
72+
73+
SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
74+
"id:100124,\
75+
phase:1,\
76+
deny,\
77+
t:none,\
78+
log,\
79+
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
80+
ver:'MRTS/0.1'"
81+
82+
SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
83+
"id:100125,\
84+
phase:2,\
85+
deny,\
86+
t:none,\
87+
log,\
88+
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
89+
ver:'MRTS/0.1'"
90+
91+
SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
92+
"id:100126,\
93+
phase:3,\
94+
deny,\
95+
t:none,\
96+
log,\
97+
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
98+
ver:'MRTS/0.1'"
99+
100+
SecRule REQUEST_COOKIES:cookie1|REQUEST_COOKIES:cookie2 "@contains attack" \
101+
"id:100127,\
102+
phase:4,\
103+
deny,\
104+
t:none,\
105+
log,\
106+
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
107+
ver:'MRTS/0.1'"
108+
109+
SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
110+
"id:100128,\
111+
phase:1,\
112+
deny,\
113+
t:none,\
114+
log,\
115+
msg:'%{MATCHED_VAR_NAME} was caught in phase:1',\
116+
ver:'MRTS/0.1'"
117+
118+
SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
119+
"id:100129,\
120+
phase:2,\
121+
deny,\
122+
t:none,\
123+
log,\
124+
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
125+
ver:'MRTS/0.1'"
126+
127+
SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
128+
"id:100130,\
129+
phase:3,\
130+
deny,\
131+
t:none,\
132+
log,\
133+
msg:'%{MATCHED_VAR_NAME} was caught in phase:3',\
134+
ver:'MRTS/0.1'"
135+
136+
SecRule REQUEST_COOKIES:/^cookie_.*$/ "@contains attack" \
137+
"id:100131,\
138+
phase:4,\
139+
deny,\
140+
t:none,\
141+
log,\
142+
msg:'%{MATCHED_VAR_NAME} was caught in phase:4',\
143+
ver:'MRTS/0.1'"
144+

generated/rules/MRTS_110_XML.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SecRule XML:/* "@beginsWith foo" \
2-
"id:100116,\
2+
"id:100132,\
33
phase:2,\
44
deny,\
55
t:none,\
@@ -8,7 +8,7 @@ SecRule XML:/* "@beginsWith foo" \
88
ver:'MRTS/0.1'"
99

1010
SecRule XML:/* "@beginsWith foo" \
11-
"id:100117,\
11+
"id:100133,\
1212
phase:3,\
1313
deny,\
1414
t:none,\
@@ -17,7 +17,7 @@ SecRule XML:/* "@beginsWith foo" \
1717
ver:'MRTS/0.1'"
1818

1919
SecRule XML:/* "@beginsWith foo" \
20-
"id:100118,\
20+
"id:100134,\
2121
phase:4,\
2222
deny,\
2323
t:none,\
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
meta:
3+
author: MRTS generate-rules.py
4+
enabled: true
5+
name: MRTS_059_REQUEST_COOKIES.yaml
6+
description: Desc
7+
tests:
8+
- test_title: 100116-1
9+
ruleid: 100116
10+
test_id: 1
11+
desc: 'Test case for rule 100116, #1'
12+
stages:
13+
- description: Send request
14+
input:
15+
dest_addr: 127.0.0.1
16+
port: 80
17+
protocol: http
18+
method: GET
19+
headers:
20+
User-Agent: OWASP MRTS test agent
21+
Host: localhost
22+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
23+
Cookie: foo=attack
24+
uri: /
25+
version: HTTP/1.1
26+
output:
27+
log:
28+
expect_ids:
29+
- 100116
30+
- test_title: 100116-2
31+
ruleid: 100116
32+
test_id: 2
33+
desc: 'Test case for rule 100116, #2'
34+
stages:
35+
- description: Send request
36+
input:
37+
dest_addr: 127.0.0.1
38+
port: 80
39+
protocol: http
40+
method: GET
41+
headers:
42+
User-Agent: OWASP MRTS test agent
43+
Host: localhost
44+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
45+
Cookie: cookie1=attack
46+
uri: /
47+
version: HTTP/1.1
48+
output:
49+
log:
50+
expect_ids:
51+
- 100116
52+
- test_title: 100116-3
53+
ruleid: 100116
54+
test_id: 3
55+
desc: 'Test case for rule 100116, #3'
56+
stages:
57+
- description: Send request
58+
input:
59+
dest_addr: 127.0.0.1
60+
port: 80
61+
protocol: http
62+
method: GET
63+
headers:
64+
User-Agent: OWASP MRTS test agent
65+
Host: localhost
66+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
67+
Cookie: cookie1=attack;cookie2=hello
68+
uri: /
69+
version: HTTP/1.1
70+
output:
71+
log:
72+
expect_ids:
73+
- 100116
74+
- test_title: 100116-4
75+
ruleid: 100116
76+
test_id: 4
77+
desc: 'Test case for rule 100116, #4'
78+
stages:
79+
- description: Send request
80+
input:
81+
dest_addr: 127.0.0.1
82+
port: 80
83+
protocol: http
84+
method: GET
85+
headers:
86+
User-Agent: OWASP MRTS test agent
87+
Host: localhost
88+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
89+
Cookie: cookie2=attack
90+
uri: /
91+
version: HTTP/1.1
92+
output:
93+
log:
94+
expect_ids:
95+
- 100116
96+
- test_title: 100116-5
97+
ruleid: 100116
98+
test_id: 5
99+
desc: 'Test case for rule 100116, #5'
100+
stages:
101+
- description: Send request
102+
input:
103+
dest_addr: 127.0.0.1
104+
port: 80
105+
protocol: http
106+
method: GET
107+
headers:
108+
User-Agent: OWASP MRTS test agent
109+
Host: localhost
110+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
111+
Cookie: cookie1=hello;cookie2=attack
112+
uri: /
113+
version: HTTP/1.1
114+
output:
115+
log:
116+
expect_ids:
117+
- 100116
118+
- test_title: 100116-6
119+
ruleid: 100116
120+
test_id: 6
121+
desc: 'Test case for rule 100116, #6'
122+
stages:
123+
- description: Send request
124+
input:
125+
dest_addr: 127.0.0.1
126+
port: 80
127+
protocol: http
128+
method: GET
129+
headers:
130+
User-Agent: OWASP MRTS test agent
131+
Host: localhost
132+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
133+
Cookie: cookie_foo=attack
134+
uri: /
135+
version: HTTP/1.1
136+
output:
137+
log:
138+
expect_ids:
139+
- 100116
140+
- test_title: 100116-7
141+
ruleid: 100116
142+
test_id: 7
143+
desc: 'Test case for rule 100116, #7'
144+
stages:
145+
- description: Send request
146+
input:
147+
dest_addr: 127.0.0.1
148+
port: 80
149+
protocol: http
150+
method: GET
151+
headers:
152+
User-Agent: OWASP MRTS test agent
153+
Host: localhost
154+
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
155+
Cookie: cookie_bar=hello;cookie_foo=attack;cookie_foobar=world
156+
uri: /
157+
version: HTTP/1.1
158+
output:
159+
log:
160+
expect_ids:
161+
- 100116

0 commit comments

Comments
 (0)