Apache APISIX forward-auth CRLF Header Injection — CVE-2026-31908
by MehranTurk (M.T) · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-31908
- Category
- web
- Affected product
- Apache APISIX
- Affected versions
- 2.12.0 through 3.15.0 (fixed in 3.16.0)
- Disclosed
- 2026-07-05
- Patch status
- patched
Tags
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-04 |
| Author / Researcher | MehranTurk (M.T) |
| CVE / Advisory | CVE-2026-31908 |
| Category | web |
| Severity | Critical |
| CVSS Score | 10.0 / 10 |
| Status | PoC |
| Tags | apisix, crlf-injection, header-injection, authentication-bypass, forward-auth, api-gateway, reverse-proxy |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Apache APISIX |
| Versions Affected | 2.12.0 through 3.15.0 (fixed in 3.16.0) |
| Language / Platform | Python 3 PoC script targeting a Java/Lua-based API gateway (Apache APISIX) |
| Authentication Required | No |
| Network Access Required | Yes |
Summary
Apache APISIX’s forward-auth plugin fails to sanitize CRLF (\r\n) sequences in inbound request headers before forwarding an authentication check upstream. By injecting CRLF sequences into headers such as Authorization, X-Forwarded-For, or Host, an unauthenticated attacker can smuggle extra headers into the forwarded auth request. The PoC script probes a target for APISIX fingerprints and admin API endpoints, sends a battery of CRLF-laden payloads against a protected path, and then attempts several header-smuggling combinations (localhost bypass, admin-status injection, role/privilege escalation) to see if any results in a 200 response on a normally-gated resource.
Vulnerability Details
Root Cause
The forward-auth plugin passes attacker-controlled header values into an internal auth-check request without stripping CRLF sequences (CWE-75), allowing injection of additional HTTP headers or, in the worst case, an entirely new smuggled request.
Attack Vector
- Attacker identifies an APISIX instance (
Serverheader or exposed/apisix/admin/*endpoints). - Attacker sends a request to a protected path with a header value containing embedded
\r\nsequences (e.g.Authorization: test\r\nX-Forwarded-For: 127.0.0.1). - The injected header/value is forwarded to (or interpreted by) the auth check, causing it to see attacker-controlled fields such as
X-Admin: true,X-Auth-Status: Success, or a spoofed source IP. - If the auth logic trusts these forwarded/smuggled headers, the request is treated as authenticated/privileged and the protected resource is returned with HTTP 200.
Impact
Unauthenticated bypass of the forward-auth access-control layer, potentially leading to privilege escalation and unauthorized access to internal/protected APISIX routes.
Environment / Lab Setup
Target: Apache APISIX 2.12.0 - 3.15.0 with forward-auth plugin enabled, fronting a protected route
Attacker: Python 3.6+, `requests` library (see requirements.txt)
Proof of Concept
PoC Script
See
CVE-2026-31908.pyin this folder.
| |
The script fingerprints the target as APISIX, probes admin endpoints, sends CRLF-injection payloads to detect anomalous responses, and finally attempts several header-smuggling auth-bypass payloads against the given protected path, reporting success if a 200 response is returned.
Detection & Indicators of Compromise
"GET /protected HTTP/1.1" ... Authorization: test%0d%0aX-Injected: malicious
Signs of compromise:
- Unexpected 500/502/400 responses from
forward-auth-protected routes correlating with unusualAuthorization,X-Forwarded-For, orHostheader values containing CR/LF sequences. - Successful 200 responses on protected paths from source IPs that never completed a legitimate auth flow.
- Duplicate or unexpected headers (e.g.
X-Admin,X-Auth-Status) appearing in upstream request logs that were not set by the gateway itself.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to Apache APISIX 3.16.0 or later |
| Interim mitigation | Strip/reject CR/LF characters in all inbound headers at the edge (WAF/reverse proxy) before they reach the forward-auth plugin; disable forward-auth until patched. |
References
Notes
Mirrored from https://github.com/MehranTurk/CVE-2026-31908 on 2026-07-05.
| |