Summary
Adminer versions before 5.4.3 contain an HTTP header injection flaw where the X-Forwarded-Prefix header is used unsanitized when constructing Set-Cookie path attributes.
An attacker who can influence this header through a misconfigured reverse proxy may manipulate cookie attributes, downgrade SameSite protections, and enable cross-origin authenticated requests that bypass cookie-based security controls.
Affected context
This vulnerability appears in Adminer deployments placed behind reverse proxies that forward client-controlled headers like X-Forwarded-Prefix.
When the application reuses this header value to build Set-Cookie path attributes without proper sanitization or normalization, the cookie metadata becomes partially attacker-controlled.
The issue is most relevant where cookies enforce authentication or CSRF protections and where reverse proxy configuration allows untrusted manipulation of forwarding headers.
Exploit preconditions
- Attack surface: Web interface exposed through a reverse proxy in front of Adminer.
- Required access: Ability to send HTTP requests where
X-Forwarded-Prefix(or equivalent) is not sanitized or overridden by the proxy; often feasible in misconfigured or shared proxy environments. - Trigger point: Server-side logic that constructs
Set-Cookieheaders using theX-Forwarded-Prefixheader value directly in the cookie Path or related attributes. - Why exploitation is possible: The application trusts the forwarding header as canonical path input and incorporates it into the
Set-Cookieresponse without validating characters, delimiters, or scope, enabling injection of crafted segments that alter cookie attributes such asSameSite.
Why this happens
The underlying flaw stems from using unvalidated, client-influenced HTTP headers when generating HTTP response headers, specifically Set-Cookie.
By incorporating X-Forwarded-Prefix directly into cookie path attributes, the application effectively allows user-controlled data to shape cookie scope and security flags.
This maps to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers, generalized here as improper sanitization of header content used in response fields, allowing manipulation of cookie attributes and weakening of SameSite protections.
Potential impact
- Attackers may downgrade or remove
SameSiteprotections, enabling cross-site authenticated requests. - They could broaden or narrow cookie path scope, affecting which routes send sensitive cookies.
- Cross-origin request protections relying on cookies can be bypassed, aiding CSRF-style attacks.
- Session integrity and authentication boundaries may be weakened, potentially leading to unauthorized actions performed under a victim's authenticated session.
General mitigation guidance
Mitigation focuses on reducing trust in upstream headers and enforcing strict control of cookie metadata.
Common defensive patterns include:
- Treating all client-controlled and proxy-forwarded headers (e.g.,
X-Forwarded-*) as untrusted and normalizing or whitelisting allowable values before reuse. - Separating internal routing logic from externally supplied path prefixes, using server-side configuration or explicit constants rather than reflecting header values into
Set-Cookieattributes. - Applying robust encoding and validation to any header-derived data used in response headers, disallowing control characters and reserved delimiters.
- Defining cookie attributes (
Path,SameSite,Secure,HttpOnly) centrally and statically where possible, instead of deriving them dynamically from request metadata. - Configuring reverse proxies to strip, normalize, or override forwarding headers coming from clients so they cannot inject arbitrary values.
How teams detect issues like this
Detection can leverage a combination of code, configuration, and runtime analysis:
- Static analysis: Search for usages where
X-Forwarded-*or similar headers are read and then used when constructingSet-Cookieheaders or other response headers without sanitization. - Code review: Flag patterns where cookie attributes, especially
PathandSameSite, are built using request header values, URL prefixes, or other user-influenced fields. - Configuration review: Examine reverse proxy and load balancer configurations to ensure client-supplied
X-Forwarded-*headers are either ignored or normalized. - Dynamic testing: Use security testing tools or scripts to inject unusual values into
X-Forwarded-Prefixand observe the resultingSet-Cookieheaders for signs of attribute manipulation or header anomalies.

