Skip to main content
Menu
Advisories

php_server with a worker match rule can serve the source of PHP scripts

GHSA-V7HF-4GQV-HF8PPublished Updated GitHub

Description

Impact

When a php_server block has a worker with a match rule and the built-in file server is enabled (the default), the raw source of some scripts under the document root can be downloaded instead of executed:

  • with extra script extensions declared with split (e.g. split .php .phtml), GET /report.phtml returns the source of report.phtml;
  • with a rewrite running before php_server that produces a script path ending with / (for instance /app/config.php/./ behind handle_path or uri strip_prefix), the source of any .php script is returned.

The leaked source can contain credentials and other secrets. Nothing is executed or modified, and files outside the document root are not reachable.

Patches

Fixed in 1.13.5.

Workarounds

Disable the built-in file server with file_server off in php_server and serve static files with a separate file_server directive, or don't use match in worker blocks.

Details

When a worker has a match pattern, php_server adds a file_server route before all its other routes, so existing static files are served before the request reaches the worker. This route excluded scripts with a hard-coded *.php path pattern, while the PHP route handles *<ext> and *<ext>/* for every extension listed in split. Paths in the second set but not the first were served as static files. For /config.php/, the path matcher keeps the trailing slash, while the file matcher and the file server drop it.

The exclusion now uses the same path patterns as the PHP route.

Proof of concept

http://localhost {
	php_server {
		root /srv/app
		split .php .phtml
		worker {
			file /srv/worker.php
			match /api/*
		}
	}
}
$ curl http://localhost/report.phtml   # returns the source of /srv/app/report.phtml

Credits

Discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-9HGVH264.

Affected versions

References

GitHub · php/frankenphp