CVE-2022-31813 Overview
Apache HTTP Server 2.4.53 and earlier versions contain a vulnerability where the server may not send X-Forwarded-* headers to the origin server when a client manipulates the Connection header using the hop-by-hop mechanism. This behavior can be exploited to bypass IP-based authentication controls on backend servers and applications, allowing attackers to circumvent security restrictions intended to limit access based on client IP addresses.
Critical Impact
Attackers can bypass IP-based authentication mechanisms on origin servers by manipulating hop-by-hop Connection headers, potentially gaining unauthorized access to protected resources and backend systems.
Affected Products
- Apache HTTP Server versions up to and including 2.4.53
- NetApp Clustered Data ONTAP
- Fedora Linux 35 and 36
Discovery Timeline
- June 9, 2022 - CVE-2022-31813 published to NVD
- May 1, 2025 - Last updated in NVD database
Technical Details for CVE-2022-31813
Vulnerability Analysis
This vulnerability relates to improper handling of HTTP headers in Apache HTTP Server's proxy functionality. The issue is classified under CWE-348 (Use of Less Trusted Source) and CWE-345 (Insufficient Verification of Data Authenticity). When Apache HTTP Server acts as a reverse proxy, it typically forwards X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Server headers to backend servers. These headers communicate the original client's IP address and other connection details, which backend applications often use for IP-based access control decisions.
The vulnerability exists in how Apache processes the client-supplied Connection header. According to HTTP specifications, the Connection header can specify hop-by-hop headers that should not be forwarded to the next server in the chain. An attacker can craft requests that exploit this mechanism to prevent the X-Forwarded-* headers from being transmitted to the origin server.
Root Cause
The root cause lies in Apache HTTP Server's implementation of the hop-by-hop header mechanism. When processing incoming requests, the server honors the Connection header directives in a way that allows clients to influence which headers are forwarded to backend servers. This design flaw permits malicious actors to strip security-critical headers that backend systems rely upon for access control decisions.
Attack Vector
The attack is network-based and can be executed remotely without authentication or user interaction. An attacker sends a specially crafted HTTP request to an Apache reverse proxy with a Connection header that lists the X-Forwarded-* headers as hop-by-hop headers. When Apache processes this request, it strips these headers before forwarding the request to the backend server.
The backend server, lacking the X-Forwarded-For header, may fall back to using the connection's direct IP address for authentication purposes. Since the direct connection comes from the trusted Apache proxy server (typically on an internal network or allowlisted IP), the backend may grant access that would otherwise be denied to the attacker's actual IP address.
This technique is particularly effective against environments where backend applications use IP allowlisting or blocklisting based on the X-Forwarded-For header value.
Detection Methods for CVE-2022-31813
Indicators of Compromise
- HTTP requests containing Connection headers that reference X-Forwarded-For, X-Forwarded-Host, or X-Forwarded-Server
- Backend server logs showing requests without expected X-Forwarded-* headers from known proxy servers
- Authentication logs indicating successful access from proxy IP addresses for resources typically restricted by client IP
- Unusual patterns of administrative or privileged access originating from reverse proxy infrastructure
Detection Strategies
- Implement log analysis rules to detect Connection headers containing X-Forwarded-* header names in incoming requests
- Monitor backend application logs for discrepancies between expected and received client IP information
- Deploy web application firewall (WAF) rules to block requests with suspicious Connection header values
- Correlate proxy server logs with backend server logs to identify header stripping patterns
Monitoring Recommendations
- Enable detailed request logging on Apache HTTP Server to capture full Connection header contents
- Configure alerting for requests where Connection header values match patterns of known header names
- Implement continuous monitoring of authentication events on backend servers for anomalous IP-based access patterns
- Review access control bypass attempts in security information and event management (SIEM) systems
How to Mitigate CVE-2022-31813
Immediate Actions Required
- Upgrade Apache HTTP Server to version 2.4.54 or later, which addresses this vulnerability
- Review and audit IP-based authentication configurations on backend servers for potential exposure
- Implement additional authentication mechanisms beyond IP-based restrictions
- Configure web application firewalls to filter suspicious Connection header manipulation attempts
Patch Information
Apache has released a security update to address this vulnerability. Administrators should upgrade to Apache HTTP Server version 2.4.54 or later. The official security advisory and patch details are available through the Apache HTTP Server Vulnerability List. Additional vendor-specific advisories have been published by NetApp Security Advisory ntap-20220624-0005 and Gentoo GLSA 202208-20.
Workarounds
- Implement backend authentication that does not solely rely on IP-based access controls
- Configure backend servers to require authentication headers that cannot be stripped through Connection header manipulation
- Use network-level controls and firewalls to restrict access to backend servers independently of application-layer headers
- Consider implementing mutual TLS (mTLS) between proxy and backend servers for stronger authentication
# Configuration example for additional access controls
# Add to Apache configuration to log Connection headers for analysis
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Connection}i\"" connection_log
CustomLog /var/log/apache2/connection.log connection_log
# Consider implementing rate limiting for suspicious request patterns
# and ensuring backend applications use multiple authentication factors
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


