|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81230 open_basedir bypass through opcache_invalidate()
Submitted: 2021-07-07 18:50 UTC Modified: 2021-07-12 17:24 UTC
From: jeffbencteux at gmail dot com Assigned:
Status: Open Package: opcache
PHP Version: 8.0.8 OS: Debian 10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-07-07 18:50 UTC] jeffbencteux at gmail dot com
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:

* 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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-12 15:35 UTC]
-Type: Security +Type: Bug
 [2021-07-12 15:35 UTC]
open_basedir bypasses are not considered to be security issues;
cf. <>
and <>.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 22 19:01:25 2023 UTC