Any ways to provide implicit blocking with ModSecurity (i mean when attacker doesn't…
- User
Any ways to provide implicit blocking with ModSecurity (i mean when attacker doesn't know request was blocked)
- Assistant
Any ways to provide implicit blocking with ModSecurity (i mean when attacker doesn't know request was blocked)
Yes, you can implement implicit blocking with ModSecurity, meaning the attacker doesn't get an explicit block page or obvious error message—instead, the request is silently dropped, delayed, or responded to with benign content. This approach helps evade detection by attackers since they don't realize their malicious request was blocked.
Here are some ways to achieve implicit blocking with ModSecurity:
deny with nolog, phase:2, pass + dropdrop action instead of deny or block. The drop action immediately terminates the TCP connection without responding to the client.Example:
SecRule REQUEST_URI "@rx attack-pattern" "id:1001,phase:2,drop,msg:'Dropped attack pattern'"
pass + skipAfter or delayInstead of blocking the request explicitly, you can allow the request but skip certain processing or introduce delays that cause the request to timeout or behave unexpectedly.
pass so the request continues downstream.SecRule to inject delays or manipulate response.Note: ModSecurity does not have a built-in delay action, but you may simulate some behavior by triggering backend delays or returning custom benign content.
Instead of returning a blocked page (e.g., 403), you can output a generic 200 OK response with empty or generic content.
You can do this by:
ctl:ruleEngine=Off for that transaction orExample:
SecRule REQUEST_URI "@rx attack-pattern" "id:1002,phase:3,ctl:ruleEngine=Off,pass,setvar:tx.anomaly_score=0,msg:'Bypassing block with benign response'"
But controlling the response body usually requires cooperation with backend or webserver configuration (like using error documents or scripting).
If your ModSecurity is running alongside a firewall capable of connection resetting or dropping (such as iptables), you can have ModSecurity trigger logging and the firewall drop connections silently.
drop): Terminates connection without response.drop should be used cautiously because it may appear as network issues to clients.If you'd like, I can help provide example ModSecurity rules for any specific implicit blocking style!
Not yet included in a published release.