@@ -292,21 +292,20 @@ SecRule REQUEST_METHOD "@rx ^(?:GET|HEAD)$" \
292
292
293
293
294
294
#
295
- # Require Content-Length to be provided with every POST request.
295
+ # Require Content-Length or Transfer-Encoding to be provided with
296
+ # every POST request.
296
297
#
297
298
# -=[ Rule Logic ]=-
298
- # This chained rule checks if the request method is POST, if so, it checks that a Content-Length
299
- # header is also present.
300
- #
301
- # -=[ References ]=-
302
- # https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5
299
+ # This chained rule checks if the request method is POST, if so,
300
+ # it checks that a Content-Length or Transfer-Encoding headers are
301
+ # also present.
303
302
#
304
303
SecRule REQUEST_METHOD "@rx ^POST$" \
305
304
"id:920180,\
306
305
phase:2,\
307
306
block,\
308
307
t:none,\
309
- msg:'POST request missing Content-Length Header .',\
308
+ msg:'POST without Content-Length or Transfer-Encoding headers .',\
310
309
logdata:'%{matched_var}',\
311
310
tag:'application-multi',\
312
311
tag:'language-multi',\
@@ -319,10 +318,11 @@ SecRule REQUEST_METHOD "@rx ^POST$" \
319
318
severity:'WARNING',\
320
319
chain"
321
320
SecRule &REQUEST_HEADERS:Content-Length "@eq 0" \
322
- "t:none,\
323
- setvar:'tx.msg=%{rule.msg}',\
324
- setvar:'tx.anomaly_score=+%{tx.notice_anomaly_score}',\
325
- setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ-%{matched_var_name}=%{matched_var}'"
321
+ "chain"
322
+ SecRule &REQUEST_HEADERS:Transfer-Encoding "@eq 0" \
323
+ "setvar:'tx.msg=%{rule.msg}',\
324
+ setvar:'tx.anomaly_score=+%{tx.notice_anomaly_score}',\
325
+ setvar:'tx.%{rule.id}-OWASP_CRS/PROTOCOL_VIOLATION/INVALID_HREQ-%{matched_var_name}=%{matched_var}'"
326
326
327
327
328
328
#
@@ -988,7 +988,7 @@ SecRule REQUEST_METHOD "!@rx ^(?:GET|HEAD|PROPFIND|OPTIONS)$" \
988
988
chain"
989
989
SecRule REQUEST_HEADERS:Content-Type "@rx ^[^;\s]+" \
990
990
"capture,\
991
- chain"
991
+ chain"
992
992
SecRule TX:0 "!@rx ^%{tx.allowed_request_content_type}$" \
993
993
"t:none,\
994
994
ctl:forceRequestBodyVariable=On,\
0 commit comments