File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 6
6
. Fixed bug #81076 (incorrect debug info on Closures with implicit binds).
7
7
(krakjoe)
8
8
. Fixed bug #81068 (Double free in realpath_cache_clean()). (Dimitry Andric)
9
+ . Fixed bug #76359 (open_basedir bypass through adding ".."). (cmb)
9
10
10
11
- Opcache:
11
12
. Fixed bug #80968 (JIT segfault with return from required file). (Dmitry)
Original file line number Diff line number Diff line change @@ -101,6 +101,11 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
101
101
* end = '\0' ;
102
102
end ++ ;
103
103
}
104
+ if (ptr [0 ] == '.' && ptr [1 ] == '.' && (ptr [2 ] == '\0' || IS_SLASH (ptr [2 ]))) {
105
+ /* Don't allow paths with a leading .. path component to be set at runtime */
106
+ efree (pathbuf );
107
+ return FAILURE ;
108
+ }
104
109
if (php_check_open_basedir_ex (ptr , 0 ) != 0 ) {
105
110
/* At least one portion of this open_basedir is less restrictive than the prior one, FAIL */
106
111
efree (pathbuf );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #76359 (open_basedir bypass through adding "..")
3
+ --FILE--
4
+ <?php
5
+ ini_set ('open_basedir ' , __DIR__ );
6
+ mkdir (__DIR__ . "/bug76359 " );
7
+ chdir (__DIR__ . "/bug76359 " );
8
+ var_dump (ini_set ('open_basedir ' , ini_get ('open_basedir ' ) . PATH_SEPARATOR . ".. " ));
9
+ chdir (".. " );
10
+ chdir (".. " );
11
+ ?>
12
+ --EXPECTF--
13
+ bool(false)
14
+
15
+ Warning: chdir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (%s) in %s on line %d
16
+ --CLEAN--
17
+ <?php
18
+ @rmdir (__DIR__ . "/bug76359 " );
19
+ ?>
You can’t perform that action at this time.
0 commit comments