Skip to main content
Menu
Advisories

Extension Workers.SendRequest() runs arbitrary files when its worker is not running

GHSA-CP2Q-FC46-38F5Published Updated GitHub

Description

Impact

Only custom builds that link a Go extension using the experimental extension workers API and forwarding client requests with Workers.SendRequest() are affected. Stock binaries and Docker images are not affected.

When the extension's worker was not running, SendRequest() did not fail: the request was served as a regular PHP request, with the server's working directory as document root and the request path as script name. A remote client could then run any PHP file below the working directory, including files outside the document root, and read other files there (such as .env) verbatim.

With Caddy, this state is reached after the configuration is reloaded twice: FrankenPHPApp.Stop() cleared the workers registered with caddy.RegisterWorkers(), and since Caddy stops the old app after starting the new one, the workers were missing from the second reload on. It is also reached with the library alone after Shutdown() and Init() without the extension's option, or when the workers are registered with an empty name. In these states SendMessage() blocked until its context ended.

Patches

Fixed in 1.13.5.

Workarounds

Restart the server instead of reloading its configuration. Extensions can also refuse to forward requests when NumThreads() returns 0, and must register their workers with a non-empty name.

Details

SendRequest() looked up its worker by name with WithWorkerName(), which left the worker unset when no worker had that name. The request then fell through to the regular request path.

WithWorkerName() now returns an error for an unknown worker name, and SendRequest() and SendMessage() return an error when the handle's worker was not started by the running instance. A call queued on a worker stopped in the meantime fails too, and the autoscaler no longer starts threads for it. Extension workers can still be missing after a reload until a separate fix lands; calls to them now return an error instead of running a script.

Proof of concept

An extension registers its workers in init() and serves a route with them:

var worker = caddy.RegisterWorkers("reports", "reports-worker.php", 2)

func (h Reports) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error {
	return worker.SendRequest(w, r)
}
example.com {
	root public/
	handle_path /reports/* {
		reports
	}
	php_server
}

After running frankenphp reload --force twice, GET /reports/bin/maintenance.php executes bin/maintenance.php from the working directory, outside the document root.

Credits

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

Affected versions

References

GitHub · php/frankenphp