HTTP Header Normalization and Request Smuggling Prevention
Description
Enforce strict HTTP header parsing on all HTTP intermediaries (proxies, load balancers, reverse proxies, web servers) to prevent request smuggling via header desynchronization. The control requires: (1) rejecting requests containing both Content-Length and Transfer-Encoding headers per RFC 7230 Section 3.3.3, (2) rejecting requests with duplicate Content-Length headers carrying differing values, (3) disabling relaxed header parsing modes that tolerate whitespace or encoding variations in Transfer-Encoding values, and (4) normalizing or rejecting header values containing illegal characters (bare CR, bare LF, NUL bytes). These measures eliminate the primary desynchronization vectors that enable an attacker to inject smuggled requests across the proxy-backend boundary.
CVSS Vector Impacts
| Metric | Transition | Rationale |
|---|---|---|
| Attack Complexity (AC) | L → H | Strict header normalization closes the standard CL/TE and duplicate-CL desync vectors, forcing the attacker to discover novel parser-specific bypass techniques to achieve smuggling |
| Integrity (I) | H → L | Preventing request smuggling eliminates the primary integrity impact: cache poisoning and request injection into other users sessions |
CWE Relationships
Verification
Verify that HTTP intermediaries enforce strict header parsing: reject requests with both Content-Length and Transfer-Encoding, reject duplicate Content-Length headers, and disable relaxed parsing modes
# Expected: off
# Expected: http-request deny
# Expected: Strict
# Expected: 1.1
# Expected: False
Remediation
printf 'proxy_http_version 1.1;\nunderscores_in_headers off;\nlarge_client_header_buffers 4 8k;\nignore_invalid_headers on;\n' > /etc/nginx/conf.d/cme-912-smuggling-prevention.conf
nginx -t
systemctl reload nginx
printf 'HttpProtocolOptions Strict\n' > /etc/httpd/conf.d/cme-912-strict-protocol.conf
apachectl configtest
systemctl reload httpd
printf '\n# CME-912: Request smuggling prevention\nhttp-request deny if { hdr_cnt(content-length) gt 1 }\nhttp-request deny if { hdr(transfer-encoding) -m found } { hdr(content-length) -m found }\noption httpclose\n' >> /etc/haproxy/haproxy.cfg
haproxy -c -f /etc/haproxy/haproxy.cfg
systemctl reload haproxy
Set-WebConfigurationProperty -Filter 'system.webServer/security/requestFiltering' -PSPath 'IIS:\' -Name allowDoubleEscaping -Value $false
Set-WebConfigurationProperty -Filter 'system.webServer/security/requestFiltering' -PSPath 'IIS:\' -Name allowHighBitCharacters -Value $false