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

GHSA-8478-XRJ3-H9C2

X-Forwarded-Prefix open redirect

Parche disponible
Descargar PNG JSON
CVSS 3.1
4.7
Media
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión5.5.0
Exposición127 dDesde la divulgación, 17 jul 2026, 8:05 a. m.
Detección126 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. Hay versiones corregidas disponibles.
Respira hondo: esta no muerde… todavía.Para el próximo sprint, sin estrés.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
17 jul 26
21 nov 26
17 jul 26
18 ago 26
19 sept 26
20 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-8478-XRJ3-H9C2 divulgada · CVSS 4.7 (GitHub)
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
The new reverse-proxy support prepends the client-supplied `X-Forwarded-Prefix` header to `$_SERVER["REQUEST_URI"]` on every request, with no configuration gate and no validation. Because `REQUEST_URI` always begins with `/`, an attacker header like `X-Forwarded-Prefix: https://evil.example` yields a fully attacker-controlled absolute URL that then flows into `Location:` redirects, the `Set-Cookie` path attribute, and every self-referential link Adminer emits.

## Severity
Medium. Authenticated open redirect (state-changing table/edit POSTs), plus unauthenticated control of the session-cookie `path` attribute and of self-referential URLs, from a single spoofable request header. The header is honoured even when Adminer is not behind a reverse proxy.

## Root Cause
`adminer/include/bootstrap.inc.php:40-42`:

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

There is no check that the request actually came through a trusted proxy and no restriction on the prefix value. The poisoned `REQUEST_URI` then reaches:
- `redirect()` / `queries_redirect()` — `header("Location: $location")` where `$location` is `$_SERVER["REQUEST_URI"]` (e.g. `adminer/db.inc.php:52`, `adminer/edit.inc.php:20`).
- `cookie_path()` — `adminer/include/functions.inc.php:324`, used for the session cookie (`bootstrap.inc.php:49`) and all `Set-Cookie` paths.

## Impact
- Open redirect: an authenticated state-changing POST (e.g. truncate/analyze/optimize in `db.inc.php`) returns `Location: https://evil.example/...`, sending the operator off-site after the action.
- Session-cookie path control (pre-auth): the attacker sets the `path=` attribute of `adminer_sid`, enabling cookie-scoping tricks / session fixation on shared hosts.
- Self-URL poisoning: links and form targets built from the poisoned URI point at the attacker's prefix on the rendered page.
- CR/LF cannot be injected (PHP `header()` strips them), so this is not header splitting or XSS.

Reproduction Steps

### Environment
- OS: Kali Linux, kernel 6.19.14+kali-amd64; PHP 8.4.21
- Adminer 5.4.5-dev

### Steps
1. Model the poisoning with the exact bootstrap + sink code:
```bash
php poc_2_xforwarded_prefix.php
```
Expected: with `X-Forwarded-Prefix: https://evil.example`, `redirect()` emits `Location: https://evil.example/adminer/?...` and `cookie_path()` returns `https://evil.example/adminer/`.
2. Live: send any request with `X-Forwarded-Prefix: https://evil.example`; observe self-links and the `Set-Cookie: adminer_sid=...; path=` reflect the prefix. For the redirect, submit an authenticated table op POST and inspect the `Location` response header.

Proof of Concept Code

<?php
// Adminer 5.4.5-dev — X-Forwarded-Prefix poisons REQUEST_URI. Models bootstrap.inc.php:40-42
// and the two sinks (redirect Location + cookie_path) with the exact source lines.

// --- attacker input ---
$_SERVER["REQUEST_URI"] = "/adminer/?server=db&username=root&db=x";
$_SERVER["HTTP_X_FORWARDED_PREFIX"] = "https://evil.example";   // spoofable request header

// --- bootstrap.inc.php:40-42 (verbatim) ---
if ($_SERVER["HTTP_X_FORWARDED_PREFIX"]) {
    $_SERVER["REQUEST_URI"] = $_SERVER["HTTP_X_FORWARDED_PREFIX"] . $_SERVER["REQUEST_URI"];
}
echo "poisoned REQUEST_URI = " . $_SERVER["REQUEST_URI"] . "\n";

// --- sink 1: redirect() Location (functions.inc.php:441, e.g. db.inc.php:52 passes REQUEST_URI) ---
$location = $_SERVER["REQUEST_URI"];
echo "Location: $location   <-- open redirect off-site\n";

// --- sink 2: cookie_path() (functions.inc.php:324), used for the session cookie path ---
$cookie_path = strtr(preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"]), array(";" => "%3B", "," => "%2C"));
echo "Set-Cookie: adminer_sid=...; path=$cookie_path   <-- attacker-set cookie path\n";

## Patch Recommendation
- Only honor `X-Forwarded-Prefix` when the request originates from a configured trusted proxy (explicit opt-in setting), matching how frameworks gate `X-Forwarded-*`.
- Require the prefix to be a path (must start with `/`, no scheme/authority) and reject anything containing `://` or a leading `//`.

## Affected Files
- `adminer/include/bootstrap.inc.php:40-42`
- `adminer/include/functions.inc.php:324` (`cookie_path`), `:441-451` (`redirect`)
- `adminer/db.inc.php:52`, `adminer/edit.inc.php:20`

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:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
8.3/ 10Alto
Vector 8.3 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida
vrana/adminer< 5.5.0
5.5.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistvrana/adminer
Corregida 5.5.0 — —
Versiones corregidas5.5.0
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-8478-xrj3-h9c2

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