Skip to content

README: document PHP_NO_EXEC_PATHS=/storage/* for Laravel - #14

Merged
michaelaguiar merged 2 commits into
mainfrom
aliasbot/ali-1102-storage-no-exec
Oct 21, 2026
Merged

michaelaguiar merged 2 commits into
mainfrom
aliasbot/ali-1102-storage-no-exec

Conversation

@michaelaguiar

Copy link
Copy Markdown
Member

Closes ALI-1102 (https://linear.app/alias-project-inc/issue/ALI-1102).

Why

The base image ships no no-exec policy, so a .php file under /storage executes when requested. That is the path the Livewire RCE (GHSA-29cq-5w36-x7w3) was exploited through in the wild. Upstream serversideup blocks it by default (their PR #641); we have the stronger mechanism (PHP_NO_EXEC_PATHS) but nothing set for Laravel.

What

README only: a "Laravel hardening" section with the recipe.

Tested

Against the local 8.4-frankenphp image with a fixture app:

Request Default PHP_NO_EXEC_PATHS=/storage/*
/storage/a/b/shell.php 200, executed 404
/storage/a/b/shell.php/foo 200, executed 400
/storage/SHELL.PHP 200, executed 404
/storage/pic.png 200 200
/index.php 200 200

Not in this PR

Defaulting the setting in the base image. That stays a decision on the ticket: only do it after checking that no consumer serves PHP from /storage.

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
… 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.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1 (fresh-context reviewer, code-review at high effort)

No P1 or P2 findings. The reviewer tried to bypass the rule and could not: .PHP/.phtml/.phar/.php5, //storage, /storage//x.php, /Storage casing, percent-encoded dots/slashes/letters, ./ and ../ segments, trailing dot/space/NUL, dir.php/index.php, and a Laravel-style public/storage symlink all either 404, 400, or redirect to a 404, and none execute. Multi-path, "replaces rather than appends" and the combination with CADDY_MEDIA_PATHS="/storage/" all hold. The docker run example is valid.

Finding Outcome
P3: "404 or 400" omits the 308 a trailing slash gets Fixed in 79f8dbc after verifying shell.php/ -> 308 -> shell.php -> 404.
P3: the rule covers only the /storage/ URL path; apps serving uploads elsewhere need to add it Fixed in 79f8dbc (one clause in the same paragraph).
P3: exact /storage (no slash) falls through to the front controller Declined. It runs public/index.php, the app itself, not storage content. Harmless.
P3: /storage/a.php.jpg is served as image/jpeg with the PHP source as its bytes Declined. Normal static serving; it is not executed. The hide-extension rule only targets a trailing extension by design.
Scope: base image default left empty Kept, as the ticket recommends. The reviewer noted nothing here claims the consumer check was done; it was not. Whether to default /storage/* stays open on ALI-1102 until Alios and other consumers are checked.

Not run: nothing beyond local containers; this is README-only.

@michaelaguiar
michaelaguiar marked this pull request as ready for review October 21, 2026 23:31
@michaelaguiar
michaelaguiar merged commit d948e22 into main Oct 21, 2026
2 checks passed
@michaelaguiar
michaelaguiar deleted the aliasbot/ali-1102-storage-no-exec branch October 21, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant