Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`) 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

The `frankenphp:wordpress` variant renders a Caddy hardening snippet at container boot:
Expand Down
Loading