From d409355517717313b774ea9811663ba64eeb837f Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Wed, 21 Oct 2026 16:27:42 -0700 Subject: [PATCH 1/2] README: document PHP_NO_EXEC_PATHS=/storage/* for Laravel The base image ships no no-exec policy, so a .php file dropped under /storage (the Livewire GHSA-29cq-5w36-x7w3 exploit path) executes when requested. Tested on the 8.4-frankenphp image: with the setting, PHP under /storage returns 404/400 and never runs, while other files still serve. ALI-1102 --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 0728ca1..5e6c6df 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,19 @@ docker run -e CADDY_IMMUTABLE_ASSET_PATHS="/build/" \ The `wordpress` variant sets both lists out of the box (see below). +## Laravel hardening + +The base image ships no no-exec policy, so a `.php` file that lands in a directory the app can write to is executed when requested. For Laravel that directory is `storage`: the Livewire upload vulnerability ([GHSA-29cq-5w36-x7w3](https://github.com/livewire/livewire/security/advisories/GHSA-29cq-5w36-x7w3)) was exploited in the wild by dropping a script there and then requesting `/storage/....php`. Set `PHP_NO_EXEC_PATHS` so nothing under `/storage/` can ever reach the PHP handler: + +```sh +docker run -e PHP_NO_EXEC_PATHS="/storage/*" \ + -e CADDY_IMMUTABLE_ASSET_PATHS="/build/" \ + -e CADDY_MEDIA_PATHS="/storage/" \ + ghcr.io/aliasproject/php:8.4-frankenphp +``` + +Requests for PHP source under that path (any case, e.g. `shell.PHP`, or with trailing path info, e.g. `shell.php/foo`) return 404 or 400 and never execute; images and other files in the directory are still served, so `public/storage` uploads keep working. Add more writable paths space-separated (`PHP_NO_EXEC_PATHS="/storage/* /uploads/*"`). `PHP_NO_EXEC_PATHS` replaces the default rather than appending, so a derived image or `docker run` that sets it must list every path it wants protected. + ## WordPress hardening The `frankenphp:wordpress` variant renders a Caddy hardening snippet at container boot: From 79f8dbc738d0f4b22ca4c60d27bf2a63af357227 Mon Sep 17 00:00:00 2001 From: Michael Aguiar Date: Wed, 21 Oct 2026 16:30:38 -0700 Subject: [PATCH 2/2] README: say what happens on a trailing slash, and that only /storage/ is covered Review of #14 found the 404/400 summary omitted the 308 redirect a trailing slash gets (verified: shell.php/ -> 308 -> shell.php -> 404), and that the section did not say the rule covers only the /storage/ URL path. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e6c6df..8fd3d6f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ docker run -e PHP_NO_EXEC_PATHS="/storage/*" \ ghcr.io/aliasproject/php:8.4-frankenphp ``` -Requests for PHP source under that path (any case, e.g. `shell.PHP`, or with trailing path info, e.g. `shell.php/foo`) return 404 or 400 and never execute; images and other files in the directory are still served, so `public/storage` uploads keep working. Add more writable paths space-separated (`PHP_NO_EXEC_PATHS="/storage/* /uploads/*"`). `PHP_NO_EXEC_PATHS` replaces the default rather than appending, so a derived image or `docker run` that sets it must list every path it wants protected. +Requests for PHP source under that path (any case, e.g. `shell.PHP`, or with trailing path info, e.g. `shell.php/foo`) never execute: they return 404 or 400, or (with a trailing slash) redirect to a URL that returns 404. Images and other files in the directory are still served, so `public/storage` uploads keep working. The rule covers only the URL path `/storage/`; if the app serves uploads or other writable files from another public path, add it too, space-separated (`PHP_NO_EXEC_PATHS="/storage/* /uploads/*"`). `PHP_NO_EXEC_PATHS` replaces the default rather than appending, so a derived image or `docker run` that sets it must list every path it wants protected. ## WordPress hardening