llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/dunglas/frankenphp

GHSA-868C-7H7M-MMJ9

Windows document-root escape in `sanitizedPathJoin` (SCRIPT_FILENAME)

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS 3.1
8.1
Alta
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición48 dDesde la divulgación, 4 oct 2026, 9:04 a. m.
Detección46 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir de cerca
Monitorear y programar la remediación
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 total. Hay versiones corregidas disponibles.
Hoy es tranquila, pero podría madrugarte.Puede que hoy no pase nada. Puede.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Parche v1.13.0
Monitoreo
Detectada +1
4 oct 26
19 nov 26
21 nov 26
4 oct 26
16 oct 26
28 oct 26
9 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-868C-7H7M-MMJ9 divulgada · CVSS 8.1 (GitHub)
Divulgación Modificada Última actualización del registro
Remediación Parche v1.13.0 github.com/dunglas/frankenphp · 0 d desde divulgación
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

On Windows, FrankenPHP’s CGI path join helper (`sanitizedPathJoin`) does not keep request-derived paths under the configured document root. A remote client can craft a URL path such that `SCRIPT_FILENAME` (and `PATH_TRANSLATED`) resolve to an absolute filesystem path outside the web root. If a PHP file exists at that location, the SAPI executes it.

This is the same failure class Caddy already fixed in `caddyhttp.SanitizedPathJoin` (`path.Clean` + `filepath.IsLocal` + `filepath.FromSlash`). FrankenPHP still uses the older `filepath.Join(root, filepath.Clean("/"+reqPath))` form adapted from historical FastCGI code.

Impact

  • Wrong-file PHP execution relative to the document-root trust boundary (potential RCE when an outside `.php` is reachable on disk).
  • Path disclosure / sensitive file targeting via `PATH_TRANSLATED` and apps that open it.
  • Who is affected: any Windows deployment of FrankenPHP (standalone binary, Windows packages, embedders calling `ServeHTTP` / `NewRequestWithContext` with a Windows document root). Default `php_server` `try_files` may reduce exposure when Caddy never forwards a traversable path; library mode and bare `php` are fully exposed.

Details

Vulnerable code

`cgi.go` (current `main`):

func sanitizedPathJoin(root, reqPath string) string {
	if root == "" {
		root = "."
	}
	path := filepath.Join(root, filepath.Clean("/"+reqPath))
	// trailing-slash restore omitted
	return path
}

Call sites:

  • `splitCgiPath` → `fc.scriptFilename = sanitizedPathJoin(fc.documentRoot, fc.scriptName)` (drives `php_execute_script`).
  • `go_update_request_info` → `path_translated = sanitizedPathJoin(fc.documentRoot, fc.pathInfo)`.
Why Windows breaks

For a normal absolute URL path `/../../outside/shell.php`:

  1. `"/"+reqPath` → `"//../../outside/shell.php"`.
  2. On Windows, `filepath.Clean` of that form does not produce a simple root-relative segment the way Unix does (UNC / volume handling keeps `..` material that later recombines badly).
  3. `filepath.Join` with a drive-absolute root then applies `..` against real directories and exits the document root.

Caddy’s fixed algorithm (v2.11.4 `modules/caddyhttp/caddyhttp.go`):

relPath := path.Clean("/" + reqPath)[1:] // slash-only clean, drop leading /
if relPath != "" && !filepath.IsLocal(relPath) {
	return root
}
return filepath.Join(root, filepath.FromSlash(relPath))

PoC

A. Stdlib-only (no FrankenPHP binary)
# mirrors cgi.go sanitizedPathJoin under Windows filepath rules
GOOS=windows go run ss001-windows-path-poc.go

Observed:

in="/index.php" out="C:\inetpub\wwwroot\index.php" under_root=true
in="/../../outside/shell.php" out="C:\outside\shell.php" under_root=false
in="/../Windows/win.ini" out="C:\inetpub\Windows\win.ini" under_root=false

Evidence file in this audit dir: `ss001-windows-path-poc.go`.

B. Full stack (Windows host)
  1. Install FrankenPHP for Windows; set document root to e.g. `C:\app\public` with a normal `index.php`.
  2. Place a marker script outside the root, e.g. `C:\outside\shell.php` containing `<?php echo "ESCAPED\n";`.
  3. Use bare `php` (no `try_files`) or the Go library API so the request path is not rewritten away:

```
GET /../../outside/shell.php HTTP/1.1
Host: localhost
```

  1. Response body is `ESCAPED` (or whatever the outside script prints).

Unix control: the same URL must stay under the document root.

Proposed fix

Replace `sanitizedPathJoin` with Caddy’s algorithm (or factor a shared helper). Add Windows unit tests covering at least:

  • `/..\windows\win.ini`
  • deep `..` chains
  • drive-letter / absolute second-segment probes

Related prior work

  • Caddy `SanitizedPathJoin` + `filepath.IsLocal` (Go issue discussion https://github.com/golang/go/issues/56336).
  • FrankenPHP already hardens Unicode path-split (GHSA-3g8v-8r37-cgjm / GHSA-g966-83w7-6w38); this is a separate Windows join bug.

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:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
7.1/ 10Alto
Vector 7.1 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
github.com/dunglas/frankenphp≤ 1.12.7
1.12.7
v1.13.6
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/dunglas/frankenphp
Corregida v1.13.0 0 d v1.13.6 no afectada
Versiones corregidasv1.13.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/php/frankenphp/security/advisories/GHSA-868c-7h7m-mmj9

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