# GHSA-G7PW-WHV8-97J7: php\_server in a Caddy named route runs with the root, env and workers of another site

- Database: GitHub
- Severity: CVSS 4.8 (Medium)
- Published: 2026-11-05
- Modified: 2026-11-05

## Affected versions

- github.com/dunglas/frankenphp/caddy (Go): from 1.13.0, through 1.13.4

## Description

### Impact

A `php_server` or `php` directive written in a Caddy named route (`&(name) { ... }`, used with `invoke`) can be attached to the PHP server of an unrelated `php_server` declared in a site block. Requests to the site invoking the named route then run the other site's PHP application, with its document root, `env` values and workers, and bypass the access rules of that other site.

For instance, if an intranet site restricted with `remote_ip` holds the first `php_server` of the site blocks, and a public site invokes a named route holding the first `php_server` of the named routes, any client of the public site reaches the intranet's front controller and the secrets it receives through `env`.

Only configurations using `php_server` or `php` inside named routes are affected.

### Patches

Fixed in 1.13.5.

### Workarounds

Don't use `php_server` or `php` in named routes: write the directive in the site blocks, or in a snippet imported with `import`.

### Details

Each `php_server` directive gets a `server_index`, so the routes it generates (including the ones added for `worker { match }`) share one PHP server and its workers. The index is counted in `httpcaddyfile.Helper.State`, but Caddy adapts named routes with a `State` map of their own, so the n-th directive of the named routes got the same index as the n-th directive of the site blocks. At start-up, FrankenPHP reused the server already registered under that index and ignored the root, environment and workers of the second module.

FrankenPHP now shares a server only between modules whose configuration, index included, is identical before provisioning, and that use the same Mercure hub.

### Proof of concept

```caddyfile
&(shop) {
	php_server {
		root /srv/shop
	}
}

http://intranet.example.com {
	@outside not remote_ip 192.0.2.0/24
	respond @outside 403

	php_server {
		root /srv/intranet
		env DATABASE_PASSWORD secret
	}
}

http://shop.example.com {
	invoke shop
}
```

```console
$ curl http://intranet.example.com/   # 403
$ curl http://shop.example.com/       # runs /srv/intranet/index.php, with DATABASE_PASSWORD in $_SERVER
```

### Credits

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-24JPX8J2.

## References

- https://github.com/php/frankenphp/security/advisories/GHSA-g7pw-whv8-97j7

Page: https://cve.now/GHSA-G7PW-WHV8-97J7

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
