Skip to content

Commit c527c75

Browse files
committed
Demonstrate defining URI and reflected response
Signed-off-by: Sebitosh <[email protected]>
1 parent e21067e commit c527c75

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
target: ARGS
2+
rulefile: DEMO_008_URI_REFLECT.conf
3+
testfile: DEMO_008_URI_REFLECT.yaml
4+
templates:
5+
- SecRule for TARGETS
6+
colkey:
7+
- - ''
8+
operator:
9+
- '@contains'
10+
oparg:
11+
- foo
12+
phase:
13+
- 2
14+
testdata:
15+
phase_methods:
16+
2: post
17+
targets:
18+
- target: ''
19+
test:
20+
data: '{"status": 201, "body": "<html>reflected-token</html>"}'
21+
input:
22+
headers:
23+
- name: Content-Type
24+
value: application/json
25+
uri: '/reflect'
26+
output:
27+
status: 201
28+
response_contains: "reflected-token"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SecRule ARGS "@contains foo" \
2+
"id:100013,\
3+
phase:2,\
4+
deny,\
5+
t:none,\
6+
log,\
7+
msg:'%{MATCHED_VAR_NAME} was caught in phase:2',\
8+
ver:'MRTS/0.1'"
9+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
meta:
3+
author: MRTS generate-rules.py
4+
enabled: true
5+
name: DEMO_008_URI_REFLECT.yaml
6+
description: Desc
7+
tests:
8+
- test_title: 100013-1
9+
ruleid: 100013
10+
test_id: 1
11+
desc: 'Test case for rule 100013, #1'
12+
stages:
13+
- description: Send request
14+
input:
15+
dest_addr: 127.0.0.1
16+
port: 80
17+
protocol: http
18+
method: POST
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+
Content-Type: application/json
24+
uri: /reflect
25+
version: HTTP/1.1
26+
data: '{"status": 201, "body": "<html>reflected-token</html>"}'
27+
output:
28+
status: 201
29+
response_contains: reflected-token

0 commit comments

Comments
 (0)