Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2021-40346

CVE-2021-40346: HAProxy Auth Bypass Vulnerability

CVE-2021-40346 is an authentication bypass flaw in HAProxy 2.0 through 2.5 caused by an integer overflow enabling HTTP request smuggling attacks. This post covers technical details, affected versions, impact, and mitigation.

Published: February 25, 2026

CVE-2021-40346 Overview

An integer overflow vulnerability exists in HAProxy versions 2.0 through 2.5 within the htx_add_header function. This flaw can be exploited to perform an HTTP request smuggling attack, allowing an attacker to bypass all configured http-request HAProxy ACLs and potentially other access controls. The vulnerability affects the HTX (HTTP/2 to HTTP/1.x translation) layer, which is responsible for handling HTTP header processing.

Critical Impact

Attackers can bypass all configured HAProxy ACLs and security controls through HTTP request smuggling, potentially gaining unauthorized access to protected backend resources.

Affected Products

  • HAProxy versions 2.0 through 2.5 (including 2.5 dev0-dev6)
  • Debian Linux 11.0
  • Fedora 33 and 34

Discovery Timeline

  • September 8, 2021 - CVE-2021-40346 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2021-40346

Vulnerability Analysis

The vulnerability resides in the htx_add_header() function within HAProxy's HTX subsystem. The HTX layer handles HTTP message representation and transformation, particularly important for HTTP/2 to HTTP/1.x translation. The function failed to properly validate the length of header names and values before processing them.

When processing HTTP headers, the function did not verify that header name lengths were within the expected 255-byte limit or that header values were within the 1MB limit. This missing validation allows attackers to craft specially formed HTTP requests with oversized headers that trigger an integer overflow condition. By exploiting this overflow, an attacker can manipulate how HAProxy parses HTTP requests, leading to request smuggling scenarios where the attacker's malicious request is interpreted differently by HAProxy and the backend server.

Root Cause

The root cause is a missing length check in the htx_add_header() function (CWE-190: Integer Overflow). The original code contained a FIXME comment acknowledging that validation for name.len (should be < 256 bytes) and value.len (should be < 1MB) was needed but not implemented. Without these boundary checks, specially crafted header values could cause integer overflow during memory allocation calculations, corrupting the internal HTX block structure.

Attack Vector

The attack is network-based and requires no authentication or user interaction. An attacker sends crafted HTTP requests with manipulated header lengths to a HAProxy instance. The integer overflow in header processing causes desynchronization between HAProxy's interpretation of request boundaries and the backend server's interpretation. This allows attackers to:

  1. Inject malicious requests that bypass HAProxy's ACL rules
  2. Access restricted backend endpoints
  3. Potentially poison caches or hijack other users' sessions
c
// Security patch in include/haproxy/htx.h
// BUG/MAJOR: htx: fix missing header name length check in htx_add_header/trailer
 {
 	struct htx_blk *blk;
 
-	/* FIXME: check name.len (< 256B) and value.len (< 1MB) */
+	if (name.len > 255 || value.len > 1048575)
+		return NULL;
+
 	blk = htx_add_blk(htx, HTX_BLK_HDR, name.len + value.len);
 	if (!blk)
 		return NULL;

Source: GitHub Commit

Detection Methods for CVE-2021-40346

Indicators of Compromise

  • Unusually large HTTP header values (exceeding 255 bytes for names or 1MB for values) in incoming requests
  • HTTP requests with multiple Content-Length headers or conflicting Content-Length and Transfer-Encoding headers
  • Backend server logs showing requests that don't appear in HAProxy access logs
  • Unexpected access to restricted endpoints that should be blocked by ACLs

Detection Strategies

  • Monitor HAProxy access logs for anomalous request patterns, particularly requests with unusual header sizes
  • Implement IDS/IPS rules to detect HTTP request smuggling patterns such as CL.TE or TE.CL desync attacks
  • Deploy web application firewall (WAF) rules to block requests with oversized headers
  • Compare HAProxy logs against backend server logs to identify discrepancies indicating successful smuggling attempts

Monitoring Recommendations

  • Enable verbose HAProxy logging with header information capture for forensic analysis
  • Set up alerts for requests attempting to access ACL-protected resources from unexpected sources
  • Monitor for increased 400-series errors that may indicate smuggling attempts being blocked
  • Implement network traffic analysis to detect malformed HTTP requests targeting HAProxy instances

How to Mitigate CVE-2021-40346

Immediate Actions Required

  • Upgrade HAProxy to a patched version immediately (2.0.25, 2.2.17, 2.3.14, 2.4.4, or later)
  • Audit HAProxy ACL configurations to identify critical access controls that may have been bypassed
  • Review backend server logs for evidence of unauthorized access during the exposure window
  • Consider implementing additional network segmentation to limit blast radius if exploitation occurred

Patch Information

HAProxy has released security patches addressing this vulnerability. The fix adds explicit length validation checks for header names (255 bytes maximum) and header values (1,048,575 bytes maximum) in the htx_add_header() and htx_add_trailer() functions. Apply the relevant patch for your HAProxy version:

  • HAProxy Security Patch Commit
  • Debian Security Advisory DSA-4968
  • Fedora Package Announcements

Workarounds

  • If immediate patching is not possible, implement strict request size limits at the network perimeter using firewall rules or upstream proxies
  • Configure an upstream reverse proxy or WAF to reject requests with header names exceeding 255 bytes or header values exceeding 1MB
  • Temporarily disable HTX mode if operationally feasible by setting option http-use-htx off (note: this may impact HTTP/2 functionality)
  • Monitor all traffic to protected endpoints with enhanced logging until patching is complete
bash
# Verify your HAProxy version
haproxy -v

# Example: Check if running a vulnerable version (2.0-2.5)
# Upgrade using your package manager
# For Debian/Ubuntu:
sudo apt update && sudo apt upgrade haproxy

# For RHEL/CentOS/Fedora:
sudo dnf update haproxy

# Restart HAProxy after upgrade
sudo systemctl restart haproxy

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeAuth Bypass

  • Vendor/TechHaproxy

  • SeverityHIGH

  • CVSS Score7.5

  • EPSS Probability92.97%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-190
  • Technical References
  • Apache CloudStack Mailing List Thread

  • Apache CloudStack Mailing List Thread

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Debian Security Advisory DSA-4968

  • HAProxy Mailing List Archive

  • HAProxy Mailing List Message
  • Vendor Resources
  • HAProxy Git Repository

  • GitHub Commit Changes

  • JFrog Blog CVE-2021-40346 Exploit
  • Related CVEs
  • CVE-2023-25725: HAProxy Auth Bypass Vulnerability

  • CVE-2026-33555: HAProxy HTTP/3 Request Smuggling Flaw

  • CVE-2025-11230: HAProxy Aloha Appliance DoS Vulnerability

  • CVE-2024-45506: HAProxy HTTP/2 DoS Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English