Skip to content

Detected request method (GET) sometimes does not match actual method (POST) #152

Closed
@theseion

Description

@theseion

Moved here from SpiderLabs/owasp-modsecurity-crs#1304.

Type of Issue

Incorrect blocking (false positive)

Description

I find sporadic instances of requests blocked by the protocol enforcement rule that checks whether GET or HEAD requests have a Content-Length header > 0. When I try to match the requests to the NGiNX access log I see POST requests (as expected). I can reproduce the requests but haven't found a way to reproduce the blocking. Note that this occurs with different URL's and different body data as well.

The frequency of these events is around 1 to 2 a day in around 20000 POST requests.

audit log sample:

---HHaiBrX0---A--
[08/Feb/2019:13:55:07 +0100] 154963050792.701804 redacted 11912 redacted 443
---HHaiBrX0---B--
GET /redacted HTTP/2.0
accept-encoding: gzip, deflate, br
cookie: redacted
content-type: application/x-www-form-urlencoded; charset=UTF-8
x-requested-with: XMLHttpRequest
referer: https://redacted
origin: https://redacted
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
x-prototype-version: 1.7.3
accept: text/javascript, text/html, application/xml, text/xml, */*
content-length: 66
host: redacted
accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7

---HHaiBrX0---C--
_k=RZAuWjdS&1&2=W3siZXZlbnQiOiJhY3Rpb24iLCJlbGVtZW50IjoiMjgifV0%3D

---HHaiBrX0---F--
HTTP/2.0 403
Server: nginx/1.14.1
Date: Fri, 08 Feb 2019 12:55:07 GMT
Content-Length: 571
Content-Type: text/html
Connection: close
Strict-Transport-Security: max-age=15768000

---HHaiBrX0---H--
ModSecurity: Warning. Matched "Operator `Rx' with parameter `^0?$' against variable `REQUEST_HEADERS:content-length' (Value: `66' ) [file "/redacted/owasp-modsecurity-crs/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "227"] [id "920170"] [rev ""] [msg "GET or HEAD Request with Body Content."] [data "GET"] [severity "2"] [ver "OWASP_CRS/3.1.0"] [maturity "0"] [accuracy "0"] [hostname "redacted"] [uri "/redacted"] [unique_id "154963050792.701804"] [ref "o0,3v0,3v65,2"]
ModSecurity: Warning. Matched "Operator `Rx' with parameter `^0?$' against variable `REQUEST_HEADERS:content-length' (Value: `66' ) [file "/redacted/owasp-modsecurity-crs/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "227"] [id "920170"] [rev ""] [msg "GET or HEAD Request with Body Content."] [data "GET"] [severity "2"] [ver "OWASP_CRS/3.1.0"] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ"] [tag "CAPEC-272"] [hostname "217.11.221.129"] [uri "/redacted"] [unique_id "154963050792.701804"] [ref "o0,3v0,3v65,2"]
ModSecurity: Access denied with code 403 (phase 2). Matched "Operator `Ge' with parameter `5' against variable `TX:ANOMALY_SCORE' (Value: `5' ) [file "/redacted/owasp-modsecurity-crs/rules/REQUEST-949-BLOCKING-EVALUATION.conf"] [line "80"] [id "949110"] [rev ""] [msg "Inbound Anomaly Score Exceeded (Total Score: 5)"] [data ""] [severity "2"] [ver ""] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-generic"] [hostname "redacted"] [uri "/redacted"] [unique_id "154963050792.701804"] [ref ""]
ModSecurity: Warning. Matched "Operator `Ge' with parameter `5' against variable `TX:INBOUND_ANOMALY_SCORE' (Value: `5' ) [file "/redacted/owasp-modsecurity-crs/rules/RESPONSE-980-CORRELATION.conf"] [line "76"] [id "980130"] [rev ""] [msg "Inbound Anomaly Score Exceeded (Total Inbound Score: 5 - SQLI=0,XSS=0,RFI=0,LFI=0,RCE=0,PHPI=0,HTTP=0,SESS=0): GET or HEAD Request with Body Content.; individual paranoia level scores: 5, 0, 0, 0"] [data ""] [severity "0"] [ver ""] [maturity "0"] [accuracy "0"] [tag "event-correlation"] [hostname "redacted"] [uri "/redacted"] [unique_id "154963050792.701804"] [ref ""]

---HHaiBrX0---Z--

Matching request from NGiNX access log:

<redacted host> <redacted ip> - - [08/Feb/2019:13:55:07 +0100] "POST /redacted HTTP/2.0" 403 185 "<redacted referrer>" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"

Your Environment

Confirmation

[x] I have removed any personal data (email addresses, IP addresses,
passwords, domain names) from any logs posted.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions