From 8f99c2a6741dd133520650e8d069d06f0c18223e Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Fri, 13 Nov 2026 09:40:15 +0100 Subject: [PATCH] Never let PHP-FPM guess the script to run cgi.fix_pathinfo = 0 makes PHP-FPM run exactly the script named in SCRIPT_FILENAME. With the default of 1, it walked back a path like /upload.phar/x.php until it found an existing file and ran that one, uploaded files included. security.limit_extensions = .php restricts PHP-FPM to .php files. The default also allows .phar, which is not on the upload blacklist of Flow. The status path used by the FPM exporter is answered before that check and keeps working. --- .../opt/flownative/php/etc/php-fpm.conf.template | 5 +++++ root-files/opt/flownative/php/etc/php.ini | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/root-files/opt/flownative/php/etc/php-fpm.conf.template b/root-files/opt/flownative/php/etc/php-fpm.conf.template index c7924d8..2b3f3b5 100644 --- a/root-files/opt/flownative/php/etc/php-fpm.conf.template +++ b/root-files/opt/flownative/php/etc/php-fpm.conf.template @@ -29,4 +29,9 @@ request_slowlog_timeout = ${PHP_FPM_REQUEST_SLOWLOG_TIMEOUT} pm.status_path = /php-fpm-status +; Only run files ending in .php. The default also allows .phar, which is not on +; the upload blacklist of Flow. The status path above is answered before this +; check and is not affected. +security.limit_extensions = .php + clear_env = no diff --git a/root-files/opt/flownative/php/etc/php.ini b/root-files/opt/flownative/php/etc/php.ini index 79a741a..593f21f 100644 --- a/root-files/opt/flownative/php/etc/php.ini +++ b/root-files/opt/flownative/php/etc/php.ini @@ -134,6 +134,16 @@ upload_max_filesize = 500M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 +;;;;;;;;;;;;;;;;;;;;;;;;; +; Paths and Directories ; +;;;;;;;;;;;;;;;;;;;;;;;;; + +; Run exactly the script the web server names in SCRIPT_FILENAME. With the +; default of 1, PHP-FPM walks back a path like /upload.phar/x.php until it finds +; an existing file and runs that one, uploaded files included. +; https://php.net/cgi.fix-pathinfo +cgi.fix_pathinfo = 0 + ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;;