CVE-2026-52845: Caddy Header Injection Vulnerability in forward_auth and php_fastcgi
Caddy, a modern web server platform, contains a header-handling vulnerability that allows authenticated attackers to inject fake identity or group information into requests sent to PHP applications. The issue stems from a mismatch in how Caddy processes headers during authentication checks versus how it later converts those headers for PHP/FastCGI backends. An attacker can exploit this by sending a specially crafted header variant that bypasses Caddy's security controls, potentially allowing privilege escalation or impersonation within downstream applications. The flaw affects versions before 2.11.4 and is corrected in that release.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 8.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
- Weaknesses (CWE)
- CWE-287, CWE-290, CWE-444
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-23 / 2026-07-15
NVD description (verbatim)
Caddy is an extensible server platform that uses TLS by default. Prior to 2.11.4, forward_auth copy_headers deletes the exact client-supplied identity header before copying the trusted value from the auth gateway. But when the request later goes through php_fastcgi, Caddy normalizes HTTP headers into CGI variables by replacing - with _. This lets a client send an underscore alias that survives the forward_auth delete step but becomes the same PHP/FastCGI variable. Result: a remote client can inject or sometimes override identity/group headers trusted by PHP/FastCGI applications behind Caddy. This vulnerability is fixed in 2.11.4.
5 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability exploits a normalization inconsistency between Caddy's forward_auth module and its php_fastcgi handler. When forward_auth is configured with copy_headers, it removes the client-supplied identity header (e.g., 'X-User-ID') to prevent spoofing. However, an attacker can submit an underscore variant of that header (e.g., 'X_User_ID'). This underscore version is not deleted by forward_auth because its name differs from the hyphenated original. Subsequently, when the request enters the php_fastcgi pipeline, Caddy normalizes HTTP headers by replacing hyphens with underscores, causing 'X-User-ID' to become 'X_USER_ID' in CGI variables. The attacker's pre-submitted 'X_User_ID' header thus survives and collides with the trusted identity value, allowing injection or override. Affected CWEs include CWE-287 (Improper Authentication), CWE-290 (Authentication Using an Unsecured Channel), and CWE-444 (Inconsistent Interpretation of HTTP Requests).
Business impact
Organizations running Caddy with forward_auth and php_fastcgi are at risk of authentication bypass or privilege escalation. A malicious insider or network-adjacent attacker (with login credentials) could impersonate users, access restricted resources, or escalate to administrative functions within PHP applications. This is particularly dangerous for SaaS platforms, multi-tenant systems, and internal applications that rely on Caddy's header-based identity delegation. Blast radius depends on how strictly the downstream PHP applications validate identity headers, but in many setups those headers are treated as authoritative, making exploitation straightforward. Data theft, lateral movement, and compliance violations (unauthorized access logs) are likely consequences.
Affected systems
Caddy versions prior to 2.11.4 are vulnerable. The flaw only manifests when both forward_auth and php_fastcgi directives are active in the same configuration, and forward_auth must be configured to copy headers from the auth gateway. Standalone Caddy instances without PHP/FastCGI backend integration are not affected. Similarly, setups using only forward_auth without downstream FastCGI processing, or those not using header-based identity, face reduced or no risk. Users should verify their Caddyfile configuration to confirm presence of both forward_auth copy_headers and php_fastcgi directives.
Exploitability
Exploitation requires the attacker to have valid credentials to send an authenticated request (CVSS PR:L). No elevated privileges or user interaction are needed, and the attack is trivial to execute: simply append an underscore variant of the target identity header to a normal request. The attack surface is exposed over the network (AV:N) with no complex conditions (AC:L). Once exploited, the attacker gains the ability to read and modify protected resources, though not to cause denial of service. The overall CVSS 3.1 score of 8.1 (HIGH) reflects the high integrity and confidentiality impact coupled with low attack complexity.
Remediation
Upgrade Caddy to version 2.11.4 or later immediately. The patch corrects the header normalization logic to ensure that underscore variants of deleted headers are also removed before downstream processing. Organizations unable to upgrade immediately should consider disabling forward_auth copy_headers or removing php_fastcgi from configurations that handle sensitive identity, though this may break legitimate application functionality. An interim workaround is to configure a request matcher in Caddy to reject requests containing underscore variants of expected identity headers, but this requires knowing all variants and is error-prone.
Patch guidance
Download and deploy Caddy 2.11.4 or later from the official caddyserver.com releases page or your distribution's package repository. Test in a staging environment first to ensure no regressions in header handling or authentication flow. If using a containerized deployment, update your base image or Docker build to pull the patched version. Verify that forward_auth and php_fastcgi configurations continue to function correctly post-upgrade, particularly checking that legitimate identity headers are still properly copied and that unauthorized underscore variants are rejected. Rollback procedures should be documented in case of unexpected issues.
Detection guidance
Monitor access logs for anomalous requests containing underscore-variant headers that match known identity field names (e.g., 'X_User_ID', 'X_Auth_User'). Look for requests where the underscore variant is present but the hyphenated original is absent—this pattern is suspicious. Correlate with downstream PHP/FastCGI application logs to identify cases where an attacker's injected header overrode an expected identity value. Security Information and Event Management (SIEM) rules should flag authentication mismatches between Caddy's forward_auth audit log and the actual identity used by the PHP application. Network-based intrusion detection may be less effective here since the traffic is legitimate in form; focus on behavioral analysis of privilege escalation or unauthorized resource access post-exploitation.
Why prioritize this
This vulnerability merits immediate prioritization for organizations matching the affected profile. The combination of high CVSS (8.1), low attack complexity, and authenticated-attacker accessibility makes it a credible insider-threat vector. The flaw directly undermines authentication and authorization controls that many SaaS and enterprise platforms depend on. While the KEV program has not yet listed it (indicating lower exploit maturity in the wild at publish time), the simplicity of the attack and the sensitivity of identity headers ensure that exploit code and techniques will proliferate quickly. Patches are available and easy to deploy, so delay is unjustifiable.
Risk score, explained
The CVSS 3.1 score of 8.1 reflects: (AV:N) network-accessible attack surface; (AC:L) no special conditions required; (PR:L) attacker must be authenticated but does not require admin rights; (UI:N) no user interaction needed; (S:U) impact is scoped to the vulnerable system alone; (C:H) high confidentiality impact via unauthorized data access; (I:H) high integrity impact via header injection; (A:N) no availability impact. The HIGH severity is appropriate because authentication bypass leading to unauthorized access and data modification are critical failures in any system, even if restricted to authenticated users. The score does not account for attack complexity in practice, which is minimal.
Frequently asked questions
Can I exploit this vulnerability without valid login credentials?
No. The CVSS rating includes PR:L (Privilege Level: Low), meaning the attacker must possess valid authentication credentials to the system. This does not require administrative privileges, but it does require the ability to send an authenticated request to Caddy. An unauthenticated outsider cannot exploit this issue.
Is the vulnerability exploited in the wild?
As of the publish date, the vulnerability has not been added to the CISA KEV (Known Exploited Vulnerabilities) catalog, suggesting limited or no active exploitation in the wild at that time. However, the simplicity of the attack and the criticality of the affected component mean that exploitation can occur rapidly once awareness spreads. Do not rely on low current exploitation rates as justification for delay.
Our PHP application validates identity headers using strict rules. Are we still at risk?
Yes. The vulnerability allows an attacker to inject or override a header value that Caddy presents to the PHP backend as trusted. If your PHP application trusts Caddy's header without additional cryptographic verification (such as a signed token), it can be spoofed. Review your application's identity validation logic; if it trusts headers directly, you are at risk until Caddy is patched.
We use Caddy but not php_fastcgi. Are we affected?
The specific vulnerability requires both forward_auth with copy_headers and php_fastcgi in the configuration. If you do not use php_fastcgi, the header normalization step does not occur, and the underscore-variant bypass is not viable. However, if you plan to add php_fastcgi in the future, ensure you upgrade Caddy first.
This analysis is provided for informational and educational purposes by SEC.co. It is not a substitute for vendor advisories, security reviews, or professional penetration testing. All vulnerability details, CVSS scores, affected versions, and patch information are derived from official vendor announcements and the National Vulnerability Database. Organizations should verify patch applicability in their environment and conduct testing before deployment. No exploit code or weaponized proof-of-concept is included; security researchers should always follow responsible disclosure practices. SEC.co makes no warranty regarding the accuracy or completeness of this analysis and assumes no liability for damages arising from its use or misuse. Source: NVD (public-domain), retrieved 2026-07-29. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-10157HIGHOpen5GS NGAP Authentication Bypass Vulnerability – 5G Core Network Risk
- CVE-2026-10167HIGHAuthentication Bypass in BrinaryBrains School Management System
- CVE-2026-10243HIGHSmart Parking System 1.0 Authentication Bypass – Remote Admin Access
- CVE-2026-10281HIGHEnderfga claw-orchestrator Authentication Bypass – Patch Available
- CVE-2026-10288HIGHHotel Reservation System Admin Authentication Bypass
- CVE-2026-10617HIGHGoClaw Webhook Authentication Bypass – Remote Exploitation
- CVE-2026-10619HIGHsayan365 Student-Management-System Remote Authentication Bypass
- CVE-2026-10777HIGHealpha072 Student-Management-System Authentication Bypass in Admin Backend