CVE-2021-40346
HAProxy vulnerability analysis and mitigation

Overview

An integer overflow vulnerability (CVE-2021-40346) was discovered in HAProxy versions 2.0 through 2.5 affecting the htxaddheader function. The vulnerability was discovered by Ori Hollander of JFrog Security and disclosed in September 2021. This vulnerability affects HAProxy, a widely used open-source load balancer proxy server that is particularly suited for high-traffic websites and is shipped with most mainstream Linux distributions (JFrog Blog).

Technical details

The vulnerability stems from an integer overflow in the htxaddheader function where header name length checks were missing. The function encodes header name length into only 8 bits (should be under 256 characters), so when a header's name is longer than 270 bytes, it causes an unsigned integer overflow. This overflow allows bits from the name field to flow into the value length field, potentially leading to HTTP request smuggling attacks (JFrog Blog, GitHub Commit). The vulnerability has been assigned a CVSS v3.1 base score of 7.5 (High) (NVD).

Impact

The vulnerability can be exploited to perform HTTP request smuggling attacks, allowing attackers to bypass all configured http-request HAProxy ACLs and possibly other ACLs. The impact includes potential unauthorized access to sensitive data, execution of unauthorized commands, modification of data, hijacking user sessions, and exploitation of reflected XSS vulnerabilities without user interaction (JFrog Blog).

Mitigation and workarounds

The vulnerability has been fixed in HAProxy versions 2.0.25, 2.2.17, 2.3.14, and 2.4.4. For users who cannot upgrade, a workaround is available by adding the following lines to HAProxy's configuration: 'http-request deny if { req.hdrcnt(content-length) gt 1 }' and 'http-response deny if { res.hdrcnt(content-length) gt 1 }'. This mitigation helps prevent all known variants of this attack (JFrog Blog, Debian Security).

Additional resources


SourceThis report was generated using AI

Related HAProxy vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-11230HIGH7.5
  • HAProxyHAProxy
  • haproxy
NoYesNov 19, 2025
CVE-2025-4953HIGH7.4
  • PodmanPodman
  • kernel-rt-modules-core
NoYesSep 16, 2025
CVE-2025-32464MEDIUM6.8
  • HAProxyHAProxy
  • haproxy-3.1
NoYesApr 09, 2025
CVE-2025-59303MEDIUM6.4
  • HAProxyHAProxy
  • haproxy
NoNoOct 08, 2025
CVE-2024-53008MEDIUM5.3
  • HAProxyHAProxy
  • cpe:2.3:a:haproxy:haproxy
NoYesNov 28, 2024

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management