php / php-src

The PHP Interpreter
https://www.php.net
Other
37.95k stars 7.73k forks source link

php.ini INI_SYSTEM: local value of "sys_temp_dir" does not overide master value and can bypass "open_basedir" (not a security issue FMPOV) #13880

Open trendymail opened 5 months ago

trendymail commented 5 months ago

Description

Hello!

I really hope this "issue" is not a duplicate: found nothing specific about this behavior in open/closed issues or mailing list archives.

Long story short: parameter "sys_temp_dir" does not seem to work as intended when overridden in a specific vhost.

So far so good... ^^

But, what really happens, is that some temporary files are still created/written in "/var/jail/allow/" directory:

# inotifywait -m -r /var/jail/ Setting up watches. Beware: since -r was given, this may take a while! Watches established. /var/jail/allow/ CREATE phpoWnujz /var/jail/allow/ OPEN phpoWnujz /var/jail/allow/ MODIFY phpoWnujz /var/jail/allow/ MODIFY phpoWnujz /var/jail/allow/ ACCESS phpoWnujz /var/jail/allow/ CLOSE_WRITE,CLOSE phpoWnujz /var/jail/allow/ DELETE phpoWnujz

Please note that path "/var/jail/allow/" is outside "open_basedir" directory and PHP does not yield any warning or error.

Also, if "sys_temp_dir" master value is set to a path not readable/writable by PHP ("www-vhost" in this case), temporary files are not created at all, even if phpinfo() says that "/vhosts/www.website.tld/var/tmp/" is used.

If you need more infos, please ask!

Have a great day and many, many thanks for PHP. :)

PHP Version

PHP 7.4.33 PHP 8.0.30 PHP 8.1.27 PHP 8.2.17 PHP 8.3.4

Operating System

Debian 12 (bookworm)

trendymail commented 4 months ago

Did I say something wrong?

Please, feel free to close this as "bogus".

Or just send me a RTFM link! :)