-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
ModSecurity v3 sends log lines multiple times
If there is a chained SecRule (for eg. CRS 920250), then the engine sends the rule messages many times as the rule chained (the 920250 sends as two times).
The lines are in reversed order, at the first place is the last chained rule, the last is the first rule (I think it about the tag actions of each chained rules).
Example output
ModSecurity: Warning. Matched "Operator `ValidateUtf8Encoding' with parameter `' against variable `ARGS:test' (Value: `test%\xff1' ) [file "/usr/share/modsecurity-crs/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "451"] [id "920250"] [rev ""] [msg "UTF8 Encoding Abuse Attack Attempt"] [data "1"] [severity "4"] [ver "OWASP_CRS/3.1.1"] [maturity "0"] [accuracy "0"] [hostname "127.0.0.1"] [uri "http://localhost/"] [unique_id "156685033144.236286"] [ref "o5,7v27,7"]
ModSecurity: Warning. Matched "Operator `ValidateUtf8Encoding' with parameter `' against variable `ARGS:test' (Value: `test%\xff1' ) [file "/usr/share/modsecurity-crs/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf"] [line "451"] [id "920250"] [rev ""] [msg "UTF8 Encoding Abuse Attack Attempt"] [data "1"] [severity "4"] [ver "OWASP_CRS/3.1.1"] [maturity "0"] [accuracy "0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-protocol"] [tag "OWASP_CRS/PROTOCOL_VIOLATION/EVASION"] [hostname "127.0.0.1"] [uri "http://localhost/"] [unique_id "156685033144.236286"] [ref "o5,7v27,7"]
Note, that Operator attributes of rule messages are equal - I guess that's not right, because each rule has an own and unique operator.
Also there is a bug (I think that's a new parser issue), that the line attributes are wrong: the logged values are not the correct line numbers, they are next empty lines after the previous rule.
How to Reproduce
With a simple curl command: curl -v "http://localhost/?test=test%FF1", and see the log.
Expected behavior
I think the expected behavior would be that every (chained) rule exists only once per request with the correct line number. But this is my question: is this a feature or a bug?