Scanner detection not worked on modsecurity 3.x if SecRequestBodyAccess is Off
See original GitHub issueDescribe the bug
I have a little problem with moving from modsecurity 2.9.3 on Apache to modsecurity 3.0.4 on nginx.
For checking I do request with curl like:
curl -H "User-Agent: Nikto" [my_host]
In my configuration i use “SecRequestBodyAccess Off”. This needed to make fastest checks and go further.
When I use ruleset with modsecurity 2.9.3 on Apache with “SecRequestBodyAccess Off” all works fine. Rule with id 913100 from REQUEST-913-SCANNER-DETECTION.conf block my request. When I use modsecurity 3.0.4 on nginx this rule doesn’t block my request. Seems like rule 913100 don’t be executed in this case at all (based on modsecurity logs: “[160585442791.933958] [/] [4] Request body processing is disabled”).
Background.
As far as i could see behaviour of SecRequestBodyAccess was changed in modsecurity 3.x against modsecurity 2.x. At modsecurity 2 this parameter just avoid reading of request body, but rules at phase 2 works if they don’t depend on request body. But since version 3 if this parameter if Off, any rules in phase 2 just dropped. For some reason rules in REQUEST-913-SCANNER-DETECTION.conf file checks REQUEST_HEADERS, but placed to phase 2. Not sure why, maybe someone can help with it?
Proposal.
Seems like there can be fixed with moving this rules (that checks only request headers, but not request body) from phase 2 to phase 1. I could try to make PR about it if this is fine from your point of view.
Steps to reproduce
- Use modsecurity 3.0.4 with nginx
- Add “SecRequestBodyAccess Off” to modsecurity configuration
- Make request:
curl -H "User-Agent: Nikto" [my_host]
- Request passed, nothing in modsecurity audit log.
Expected behaviour
Request is blocked just like in case with apache and modsecurity 2.x.
Actual behaviour
Request passed, nothing in modsecurity audit log.
Your Environment
Ruleset version: 3.0.2, also checked on 3.4/dev branch with same result. Paranoia level: 1 ModSecurity version: 3.0.4 nginx version: nginx/1.18.0 OS: CentOS-7
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Hi @SandakovMM,
You’re welcome - it’s good to see that helped to you.
Yep, I see your pain. But I’m afraid we can’t help it immediately.
Yes, you’re absolutely right.
I’ve added a comment to the issue at ModSecurity. If you want to follow that thread, you can subscribe it.
We (CRS team) will have the meeting next Monday, hope we can discuss this request.
Hooray! Thank you very much @airween