File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed
fpm-apache/etc/apache2/conf-available
fpm-nginx/etc/nginx/site-opts.d
frankenphp/etc/frankenphp Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains
5555# | File Access Restrictions |
5656# ------------------------------------------------------------------------------
5757
58+ # Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
59+ # Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
60+ <LocationMatch "^/storage/.*\.php$">
61+ Require all denied
62+ </LocationMatch>
63+
5864# Block access to all hidden files and directories (dotfiles)
5965# EXCEPT for the "/.well-known/" directory which is required by RFC 8615
6066# for ACME challenges, security.txt, and other standardized endpoints.
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ location / {
3030 try_files $uri $uri/ /index.php?$query_string;
3131}
3232
33+ # Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
34+ # Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
35+ location ~* ^/storage/.*\.php$ {
36+ deny all;
37+ }
38+
3339# Pass "*.php" files to PHP-FPM
3440location ~ \.php$ {
3541 fastcgi_pass 127.0.0.1:9000;
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ location / {
3636 try_files $uri $uri/ /index.php?$query_string;
3737}
3838
39+ # Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
40+ # Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
41+ location ~* ^/storage/.*\.php$ {
42+ deny all;
43+ }
44+
3945# Pass "*.php" files to PHP-FPM
4046location ~ \.php$ {
4147 fastcgi_pass 127.0.0.1:9000;
Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ fd00::/8 \
138138 # RFC 8615 - Well-Known URIs
139139 # https://www.rfc-editor.org/rfc/rfc8615
140140
141+ # Block PHP execution in storage directory to prevent uploaded malicious PHP files from running
142+ # Reference: Livewire arbitrary file upload (GHSA-29cq-5w36-x7w3)
143+ @storage-php path_regexp ^/storage/.* \.php$
144+ respond @storage-php 403
145+
141146 # Block access to files that may expose sensitive information
142147 @rejected {
143148 path *.bak *.conf *.config *.dist *.inc *.ini *.log *.sh *.sql *.swp *.swo * ~ */ .*
You can’t perform that action at this time.
0 commit comments