Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains
# | File Access Restrictions |
# ------------------------------------------------------------------------------

# Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
# Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
<LocationMatch "^/storage/.*\.php$">
Require all denied
</LocationMatch>

# Block access to all hidden files and directories (dotfiles)
# EXCEPT for the "/.well-known/" directory which is required by RFC 8615
# for ACME challenges, security.txt, and other standardized endpoints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ location / {
try_files $uri $uri/ /index.php?$query_string;
}

# Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
# Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
location ~* ^/storage/.*\.php$ {
deny all;
}

# Pass "*.php" files to PHP-FPM
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ location / {
try_files $uri $uri/ /index.php?$query_string;
}

# Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
# Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
location ~* ^/storage/.*\.php$ {
deny all;
}

# Pass "*.php" files to PHP-FPM
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
Expand Down
5 changes: 5 additions & 0 deletions src/variations/frankenphp/etc/frankenphp/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ fd00::/8 \
# RFC 8615 - Well-Known URIs
# https://www.rfc-editor.org/rfc/rfc8615

# Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
# Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
@storage-php path_regexp ^/storage/.*\.php$
respond @storage-php 403

# Block access to files that may expose sensitive information
@rejected {
path *.bak *.conf *.config *.dist *.inc *.ini *.log *.sh *.sql *.swp *.swo *~ */.*
Expand Down
Loading