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

GHSA-XXJP-CJXR-2X6M

CGI Path-Split Boundary Bypass

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

Parche disponible
Descargar PNG JSON
CVSS 3.1
6.5
Media
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N 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
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, automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Agenda, parchea y celebra con un mate.Bien priorizada, bien dormida.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
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-XXJP-CJXR-2X6M divulgada · CVSS 6.5 (GitHub)
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

FrankenPHP's CGI path splitting (`splitPos` in `cgi.go`) locates the `.php` split string by raw substring search without requiring a path-segment boundary, while the sibling splitter used by the surrounding Caddy file matching (`MatchFile.firstSplit`) explicitly refuses to split unless the match ends at a segment boundary. The two splitters therefore disagree on paths that contain `.php` inside a filename component (for example `a.php.txt`). A request such as `/uploads/a.php.txt/b.php` is admitted by the PHP route matcher (it ends in `.php`), and FrankenPHP then splits at the *inner* `.php` - executing `uploads/a.php` as a PHP script with an attacker-chosen `PATH_INFO` - even when direct access to `uploads/a.php` is denied by a route-level block (403) or an external WAF. This bypasses extension-based execution protections and lets an unauthenticated remote attacker run any normally-protected `.php` file present under the document root and forge `PATH_INFO`/`SCRIPT_NAME`/`PHP_SELF` for applications that derive state from them.

Vulnerability Details

FrankenPHP serves PHP by splitting the request path at the first occurrence of a configure split string (default `".php"`), mirroring classic CGI `PATH_INFO` semantics. The split is performed by `splitPos` (`cgi.go:242-283` at pinned commit `daead870980d2aba0c2df76cbea880b5a608ff0b`):

func splitPos(path string, splitPath []string) int {
	if len(splitPath) == 0 {
		return 0
	}
	pathLen := len(path)
	for _, split := range splitPath {
		splitLen := len(split)
		if splitLen == 0 || splitLen > pathLen {
			continue
		}
		for i := 0; i <= pathLen-splitLen; i++ {
			match := true
			for j := range splitLen {
				c := path[i+j]
				if c >= utf8.RuneSelf {
					match = false
					break
				}
				if 'A' <= c && c <= 'Z' {
					c += 'a' - 'A'
				}
				if c != split[j] {
					match = false
					break
				}
			}
			if match {
				return i + splitLen
			}
		}
	}
	return -1
}

`splitPos` returns the first `.php` substring it finds anywhere in the path, with no constraint on what follows it. The Caddy file matcher that drives the `php_server` `try_files`/`index` machinery implements the same kind of case-insensitive search but with a segment-boundary guard (`modules/caddyhttp/fileserver/matcher.go:579-592`, Caddy v2.11.4, the version pinned in `caddy/go.mod`):

func (m MatchFile) firstSplit(path string) (splitPart, remainder string) {
	for _, split := range m.SplitPath {
		if idx := indexFold(path, split); idx > -1 {
			pos := idx + len(split)
			// skip the split if it's not the final part of the filename
			if pos != len(path) && !strings.HasPrefix(path[pos:], "/") {
				continue
			}
			return path[:pos], path[pos:]
		}
	}
	return path, ""
}

The guard (`pos != len(path) && !strings.HasPrefix(path[pos:], "/")` -> skip) exists precisely to prevent a `.php` occurrence embedded inside a filename component (e.g. `a.php.txt`) from being treated as a split point. FrankenPHP's `splitPos` has no equivalent guard. `splitCgiPath` (`cgi.go:190-234`) then derives the executed script from the split result: `docURI = path[:splitPos]`, `pathInfo = path[splitPos:]`, `scriptName = docURI`, `scriptFilename = sanitizedPathJoin(documentRoot, scriptName)`, and the PHP SAPI executes `scriptFilename`.

For the request path `/uploads/a.php.txt/b.php`:
- the `php_server` route matcher admits it: the route list built in `caddy/module.go` contains a matcher `path` = `*.php` OR `*.php/*` (the `*.php` arm matches - the path ends in `.php`) and, in default configurations, the preceding `try_files` rewrite only fires when a try-file exists (see "Reproduction" for the two configurations where it does not);
- Caddy's `firstSplit` refuses to split at the inner `.php` (next byte is `.`, not end-of-path and not `/`), so the Caddy-level resource for the path is the whole `a.php.txt/b.php`;
- FrankenPHP's `splitPos` splits at the inner `.php`, producing `docURI = /uploads/a.php`, `pathInfo = .txt/b.php`, and executing `documentRoot/uploads/a.php` - the file the route-level protection was blocking - with the attacker-controlled `.txt/b.php` delivered as `PATH_INFO` (and visible in `SCRIPT_NAME`/`PHP_SELF`).

Why the deny rule admits the request, deterministically: the hardened configuration's block (`@blocked path /uploads/*.php`) is Caddy's `path` matcher (`modules/caddyhttp/matchers.go`, `MatchPath.MatchWithError`, v2.11.4). Because that pattern's single `*` sits between literal segments, matching uses Go's `path.Match` glob, in which `*` cannot span `/`: `/uploads/*.php` denies only immediate children of `/uploads` whose name ends in `.php` (e.g. `/uploads/a.php`), and cannot match the multi-segment `/uploads/a.php.txt/b.php`. The `php_server` admission matcher uses the pattern `*.php` - also a `path` matcher, but its single `*` is in the leading position, which takes the documented suffix fast-path `strings.HasSuffix(path, ".php")`, matching any path whose final bytes are `.php` regardless of segment count. The same Caddy matcher module therefore both refuses the request at the deny rule and admits it to the PHP handler; the CGI splitter's missing boundary guard is what converts the admitted path into execution of the denied file. The same admission logic exists in the default configuration, where no deny rule is needed for the effect (the `try_files` rewrite's `SplitPath` uses `firstSplit`, which refuses the inner split, so the path passes to `php_server` and the same divergence fires, as D2/D3 show).

This is the same function that received two security fixes this year for adjacent split-confusion classes (CVE-2026-24895 / GHSA-g966-83w7-6w38, and CVE-2026-45062 / GHSA-3g8v-8r37-cgjm, both fixing `splitPos`); neither fix added the boundary guard, so the substring-match primitive survives. The guard asymmetry is demonstrated by differential parity testing of the two functions (a harness feeding the identical adversarial path corpus to both splitters), which enumerates the diverging inputs, and by the loopback reproduction below.

Impact

An unauthenticated remote attacker can:

  1. Execute any existing `.php` file under the document root that the application deliberately protects from direct execution - e.g. a route-level block on `/uploads/*.php`, a WAF rule, or an application convention that uploads are never executable - by requesting a path that embeds that filename as a `.php`-suffixed component followed by an arbitrary trailing segment, e.g. `/uploads/a.php.txt/x.php` executes `uploads/a.php`. The protection is silently bypassed because the request path never names the script as a path segment; this defeats extension-matching deny rules, reverse-proxy/WAF filters, and audit expectations. Scripts in this position typically include upload-area backups, generated preview/thumbnail handlers, cron or admin helpers placed under the web root, and similar files whose direct invocation is intentionally blocked.
  2. Forge `PATH_INFO` (and derived `SCRIPT_NAME`/`PHP_SELF`/`REQUEST_URI` values) for any executed script. Applications that perform routing, access control, or CSRF checks based on `PATH_INFO`/`PHP_SELF` (a common pattern in legacy PHP routers) can be driven into unintended control flow with an attacker-chosen virtual sub-path.

The executed file always ends in `.php` (the split point is the end of the matched split string), so independent script execution of non-PHP files is not part of this finding; the impact is the bypass of execution protection for real `.php` files plus path-variable spoofing. The default-`index` configuration still exhibits the divergence when the attacker can create a directory whose name embeds `.php` (see Reproduction, D2 - e.g. via archive extraction or upload-to-directory features).

CVSS 3.1: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N` = 6.5 (Medium). Per-metric justification: AV:N - the attacker only sends HTTP requests; AC:L - no special conditions beyond the described configuration (an app using `php_server` with `index off`, or with a `.php`-named directory reachable in a default-index deployment); PR:N - no account or capability required in the primary (`index off`) scenario; UI:N - no victim interaction; S:U - the vulnerable component is the PHP-server request handling itself, no separate security authority is violated; C:L - output/behavior of protected scripts disclosed to the requester (the typical protected-file primitive is informational); I:L - a protected script is executed and path variables are spoofed, steering application logic; A:N - no availability impact. In default-`index` deployments where the attacker must first create a `.php`-embedded directory name, the effective privilege becomes PR:L and the score drops to 5.4; the 6.5 score reflects the reachable `index off` configuration which this document reproduces.

Primary weakness: CWE-436 (Interpretation Conflict) - FrankenPHP's CGI path splitter and Caddy's routing/file-splitting layer interpret the same request path with different segment semantics (raw substring match vs segment-boundary match), and that divergence is what turns an admitted request into execution of a script the routing layer denies.

Reproduction Steps

The reproduction is fully local and loopback-bound (the FrankenPHP instance listens on `127.0.0.1` only; no external host is contacted). It uses the official static release binary `frankenphp-linux-x86_64` v1.12.7 (`splitPos` in the tagged release is behaviorally identical to the pinned commit `daead870`; the only later edits to `cgi.go` are worker plumbing around the split and a Go-idiom loop rewrite, none of which change split semantics).

Setup (on a Linux x86_64 host with curl; the binary only):

mkdir -p /tmp/fp-htest/public/uploads
cd /tmp/fp-htest
curl -sL -o frankenphp https://github.com/php/frankenphp/releases/download/v1.12.7/frankenphp-linux-x86_64
chmod +x frankenphp
printf '<?php echo "EXEC-INDEX\\n";' > public/index.php
printf '<?php echo "EXEC-A PATH_INFO=|".($_SERVER["PATH_INFO"]??"")."|\\n";' > public/a.php
printf '<?php echo "UPLOADS-A-EXECUTED PATH_INFO=|".($_SERVER["PATH_INFO"]??"")."|\\n";' > public/uploads/a.php
printf '<?php echo "HONEYPOT-EXECUTED\\n";' > public/uploads/a.php.txt
cat > Caddyfile <<'CADDY'
{
	auto_https off
	admin off
}

:8080 {
	root * /tmp/fp-htest/public
	route {
		@blocked path /uploads/*.php
		respond @blocked 403
		php_server {
			index off
		}
	}
}

:8081 {
	root * /tmp/fp-htest/public
	php_server
}
CADDY
nohup ./frankenphp run --config Caddyfile > server.log 2>&1 &
sleep 4

Port 8080 models a hardened application: `index off` (a documented `php_server` option used by APIs that do not want an index fallback) plus an explicit route-level deny of `/uploads/*.php`. Port 8081 is the stock default `php_server`. Request matrix (observed output inlined):

# Control 1 - protected script is denied directly (hardened config):
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/uploads/a.php
403

# Finding V1 - the same protected script executes via the divergent path
# (split at the inner ".php" of a.php.txt; PATH_INFO attacker-injected):
curl -s http://127.0.0.1:8080/uploads/a.php.txt/b.php
UPLOADS-A-EXECUTED PATH_INFO=|.txt/b.php|

# Finding V2 - arbitrary trailing segment:
curl -s http://127.0.0.1:8080/uploads/a.php.txt/x.php
UPLOADS-A-EXECUTED PATH_INFO=|.txt/x.php|

# Finding V3 - no ".txt" needed, any byte after the inner ".php":
curl -s http://127.0.0.1:8080/a.phpx/b.php
EXEC-A PATH_INFO=|x/b.php|

# Control 2 - default config (index fallback active): the same path is
# captured by try_files and rewritten to index.php (divergence not reached):
curl -s http://127.0.0.1:8081/uploads/a.php.txt/b.php
EXEC-INDEX

# Finding D2 - default config, attacker-created directory "shell.php.txt"
# containing a nested file (e.g. via archive extraction): the divergence
# fires even with the stock index fallback:
mkdir -p public/uploads/shell.php.txt
printf '<?php echo "INNER";' > public/uploads/shell.php.txt/b.php
printf '<?php echo "SHELL-PHP-EXECUTED PATH_INFO=|".($_SERVER["PATH_INFO"]??"")."|\\n";' > public/uploads/shell.php
curl -s http://127.0.0.1:8081/uploads/shell.php.txt/b.php
SHELL-PHP-EXECUTED PATH_INFO=|.txt/b.php|

The safe behavior (what a corrected implementation should produce) is visible in Control 1 (protected file denied) and Control 2 (request routed according to the Caddy-level resource). The vulnerable behavior is that the two identical-looking paths execute a protected PHP script that the request never names as a path segment, with forged `PATH_INFO`.

Recommendations

  1. Mirror Caddy's `firstSplit` loop structure exactly in `splitPos` (`cgi.go:242`): for each split string in order, take the first occurrence of that split string; if it does not end the path and is not followed by `/`, move on to the next split string entirely rather than continuing to scan the same path for another occurrence of the same split; on a boundary match, return it. This makes the FrankenPHP splitter agree with the Caddy splitter on every input and closes both the `index off` and the directory-trick classes. (A guard that skips to a later position and keeps scanning the same split string would itself diverge from `firstSplit` on inputs like `/x.php.y/z.php`; the loop structure, not just the boundary predicate, must match.)
  2. Add a differential regression test comparing `splitPos` against Caddy's `firstSplit` over a corpus of adversarial paths (a parity harness that feeds the identical corpus to both splitters, patched into the existing `cgi_test.go` fuzzers, and fails CI on any divergence), so a future mismatch between the two splitters is caught before release.
  3. Consider applying the same guard to any other path-splitting helper in the CGI path (worker `match` handling and the `php` directive's internal splits) and re-running the fuzzers that were recently added for `cgi.go` (`2e33427`) with boundary-aware seeds.

References

  • Pinned source: `https://github.com/php/frankenphp @ daead870980d2aba0c2df76cbea880b5a608ff0b` - `cgi.go:190-234` (`splitCgiPath`), `cgi.go:242-283` (`splitPos`), `caddy/module.go` (`php_server` route list, `*.php` matcher, `index off` handling).
  • Sibling splitter with the guard: Caddy v2.11.4 `modules/caddyhttp/fileserver/matcher.go:579-592` (`MatchFile.firstSplit`), version pinned in `caddy/go.mod`.
  • Route admission/denial matcher semantics: Caddy v2.11.4 `modules/caddyhttp/matchers.go` (`MatchPath.MatchWithError`: single-interior-wildcard globs fall through to `path.Match`, whose `*` cannot span `/`; single-leading-wildcard patterns use `strings.HasSuffix`) and `modules/caddyhttp/fileserver/matcher.go:579-592`.
  • Prior fixes to the same function: CVE-2026-24895 / GHSA-g966-83w7-6w38 (fix commit `04fdc0c`) and CVE-2026-45062 / GHSA-3g8v-8r37-cgjm (fix commit `2d0f480`); neither fix adds the boundary guard this finding requires.
  • In-tree behavior note: `cgi_test.go` asserts the inner split as intended for `/shell.php.txt.php` (`scriptName` `/shell.php`, `pathInfo` `.txt.php`, "should match first .php"); the flaw filed here is the divergence between `splitPos` and Caddy's `firstSplit`, which no in-tree test or advisory covers.
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:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:L
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy 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-xxjp-cjxr-2x6m

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