-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
When a rule decides a drop in phase 1, the TCP is immediately closed (which is good and intended), however the handler behind is still somehow called. If this handler is "proxy-server", it will stay stuck until the global request timeout (5mn) shuts it down.
This has the nasty side-effect of keeping an Apache thread of process busy all that time.
Example with a (CRS-inspired) rule that drops GETs with a content-length:
SecRule REQUEST_METHOD "^(?:GET|HEAD)$"
"msg:'GET or HEAD Request with Body Content.',
severity:'2',
id:'960011',
phase:1,
drop,
logdata:'%{matched_var}',
t:none,
tag:'OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ',
tag:'CAPEC-272',
chain"
SecRule REQUEST_HEADERS:Content-Length "!^0?$"
"t:none,
setvar:'tx.msg=%{rule.msg}',
setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},
setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ-%{matched_var_name}=%{matched_var}'"
The %D (duration) log pattern, for such cases, expands to 300000000 (5 minutes), though tcpdump shows that the TCP was terminated quickly (FINs exchanged with client).