CVE-2023-40225
📋 TL;DR
HAProxy versions through multiple branches forward empty Content-Length headers, violating HTTP standards. This can cause HTTP/1 servers behind HAProxy to misinterpret requests, potentially treating payload data as additional requests. Organizations using affected HAProxy versions as reverse proxies or load balancers are vulnerable.
💻 Affected Systems
- HAProxy
📦 What is this software?
Haproxy by Haproxy
Haproxy by Haproxy
Haproxy by Haproxy
Haproxy by Haproxy
Haproxy by Haproxy
Haproxy by Haproxy
⚠️ Risk & Real-World Impact
Worst Case
Request smuggling leading to cache poisoning, session hijacking, or unauthorized access to backend systems
Likely Case
Request parsing errors causing application instability, failed transactions, or degraded service
If Mitigated
Minor request processing anomalies with no security impact if backend servers properly validate headers
🎯 Exploit Status
Exploitation requires specific backend server behavior and uncommon conditions per CVE description
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 2.6.15, 2.7.10, 2.8.2, or later versions in respective branches
Vendor Advisory: https://www.haproxy.org
Restart Required: Yes
Instructions:
1. Identify HAProxy version with 'haproxy -v'. 2. Download patched version from haproxy.org. 3. Stop HAProxy service. 4. Install new version. 5. Restart HAProxy service.
🔧 Temporary Workarounds
HTTP/2 Backend Configuration
allConfigure HAProxy to use HTTP/2 for backend connections where supported
backend my_backend
server srv1 192.168.1.1:80 proto h2
Content-Length Header Filtering
allUse HAProxy configuration to filter or normalize empty Content-Length headers
http-request set-header Content-Length "" if { hdr_val(Content-Length) eq 0 }
🧯 If You Can't Patch
- Implement WAF or reverse proxy in front of HAProxy to filter malicious requests
- Configure backend servers to reject requests with empty Content-Length headers
🔍 How to Verify
Check if Vulnerable:
Run 'haproxy -v' and compare version against affected ranges
Check Version:
haproxy -v
Verify Fix Applied:
Verify version is 2.6.15+, 2.7.10+, 2.8.2+, or later branch versions
📡 Detection & Monitoring
Log Indicators:
- Backend server errors related to request parsing
- HTTP 400/413 errors from backend servers
Network Indicators:
- Unusual request patterns with empty Content-Length headers
- Multiple requests appearing as single request to backend
SIEM Query:
source="haproxy.log" AND ("Content-Length:" AND "\"\"")
🔗 References
- https://cwe.mitre.org/data/definitions/436.html
- https://github.com/haproxy/haproxy/commit/6492f1f29d738457ea9f382aca54537f35f9d856
- https://github.com/haproxy/haproxy/issues/2237
- https://www.haproxy.org/download/2.6/src/CHANGELOG
- https://www.haproxy.org/download/2.7/src/CHANGELOG
- https://www.haproxy.org/download/2.8/src/CHANGELOG
- https://cwe.mitre.org/data/definitions/436.html
- https://github.com/haproxy/haproxy/commit/6492f1f29d738457ea9f382aca54537f35f9d856
- https://github.com/haproxy/haproxy/issues/2237
- https://www.haproxy.org/download/2.6/src/CHANGELOG
- https://www.haproxy.org/download/2.7/src/CHANGELOG
- https://www.haproxy.org/download/2.8/src/CHANGELOG