Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit c92aa4a

Browse files
authored
Merge pull request #1525 from fgsch/fgsch/bypass-931130
Fix bypass in 931130 by matching on end of hostname
2 parents 43e14ae + 5f60c3b commit c92aa4a

File tree

2 files changed

+105
-3
lines changed

2 files changed

+105
-3
lines changed

rules/REQUEST-931-APPLICATION-ATTACK-RFI.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ SecRule TX:EXECUTING_PARANOIA_LEVEL "@lt 2" "id:931014,phase:2,pass,nolog,skipAf
104104
# -= Paranoia Level 2 =- (apply only when tx.executing_paranoia_level is sufficiently high: 2 or higher)
105105
#
106106

107-
SecRule ARGS "@rx ^(?i:file|ftps?|https?)://(.*)$" \
107+
SecRule ARGS "@rx ^(?i:file|ftps?|https?)://([^/]*).*$" \
108108
"id:931130,\
109109
phase:2,\
110110
block,\
@@ -122,9 +122,9 @@ SecRule ARGS "@rx ^(?i:file|ftps?|https?)://(.*)$" \
122122
ctl:auditLogParts=+E,\
123123
ver:'OWASP_CRS/3.2.0',\
124124
severity:'CRITICAL',\
125-
setvar:'tx.rfi_parameter_%{MATCHED_VAR_NAME}=%{tx.1}',\
125+
setvar:'tx.rfi_parameter_%{MATCHED_VAR_NAME}=.%{tx.1}',\
126126
chain"
127-
SecRule TX:/rfi_parameter_.*/ "!@beginsWith %{request_headers.host}" \
127+
SecRule TX:/rfi_parameter_.*/ "!@endsWith .%{request_headers.host}" \
128128
"setvar:'tx.rfi_score=+%{tx.critical_anomaly_score}',\
129129
setvar:'tx.anomaly_score_pl2=+%{tx.critical_anomaly_score}'"
130130

util/regression-tests/tests/REQUEST-931-APPLICATION-ATTACK-RFI/931130.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,105 @@
8989
version: HTTP/1.1
9090
output:
9191
log_contains: id "931130"
92+
-
93+
test_title: 931130-6
94+
desc: Partial match
95+
stages:
96+
-
97+
stage:
98+
input:
99+
dest_addr: 127.0.0.1
100+
headers:
101+
User-Agent: "ModSecurity CRS 3 Tests"
102+
Host: example.com
103+
method: GET
104+
port: 80
105+
uri: /?x=https://evilexample.com/
106+
version: HTTP/1.1
107+
output:
108+
log_contains: id "931130"
109+
-
110+
test_title: 931130-7
111+
desc: Mismatching domains
112+
stages:
113+
-
114+
stage:
115+
input:
116+
dest_addr: 127.0.0.1
117+
headers:
118+
User-Agent: "ModSecurity CRS 3 Tests"
119+
Host: example.com
120+
method: GET
121+
port: 80
122+
uri: /?x=https://example.com.evil.com/
123+
version: HTTP/1.1
124+
output:
125+
log_contains: id "931130"
126+
-
127+
test_title: 931130-8
128+
desc: Mismatching ports
129+
stages:
130+
-
131+
stage:
132+
input:
133+
dest_addr: 127.0.0.1
134+
headers:
135+
User-Agent: "ModSecurity CRS 3 Tests"
136+
Host: example.com
137+
method: GET
138+
port: 80
139+
uri: /?x=https://example.com:1234/
140+
version: HTTP/1.1
141+
output:
142+
log_contains: id "931130"
143+
-
144+
test_title: 931130-9
145+
desc: Matching hosts
146+
stages:
147+
-
148+
stage:
149+
input:
150+
dest_addr: 127.0.0.1
151+
headers:
152+
User-Agent: "ModSecurity CRS 3 Tests"
153+
Host: example.com
154+
method: GET
155+
port: 80
156+
uri: /?x=https://example.com/
157+
version: HTTP/1.1
158+
output:
159+
no_log_contains: id "931130"
160+
-
161+
test_title: 931130-10
162+
desc: Matching hosts and ports
163+
stages:
164+
-
165+
stage:
166+
input:
167+
dest_addr: 127.0.0.1
168+
headers:
169+
User-Agent: "ModSecurity CRS 3 Tests"
170+
Host: example.com
171+
method: GET
172+
port: 80
173+
uri: /?x=https://example.com:1234/
174+
version: HTTP/1.1
175+
output:
176+
log_contains: id "931130"
177+
-
178+
test_title: 931130-11
179+
desc: Subdomains
180+
stages:
181+
-
182+
stage:
183+
input:
184+
dest_addr: 127.0.0.1
185+
headers:
186+
User-Agent: "ModSecurity CRS 3 Tests"
187+
Host: example.com
188+
method: GET
189+
port: 80
190+
uri: /?x=http://www.example.com/some/path
191+
version: HTTP/1.1
192+
output:
193+
no_log_contains: id "931130"

0 commit comments

Comments
 (0)