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 4
4
5
5
- Core:
6
6
. Fixed bug #81068 (Double free in realpath_cache_clean()). (Dimitry Andric)
7
+ . Fixed bug #76359 (open_basedir bypass through adding ".."). (cmb)
7
8
8
9
- Standard:
9
10
. Fixed bug #81048 (phpinfo(INFO_VARIABLES) "Array to string conversion").
Original file line number Diff line number Diff line change @@ -110,6 +110,11 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
110
110
* end = '\0' ;
111
111
end ++ ;
112
112
}
113
+ if (ptr [0 ] == '.' && ptr [1 ] == '.' && (ptr [2 ] == '\0' || IS_SLASH (ptr [2 ]))) {
114
+ /* Don't allow paths with a leading .. path component to be set at runtime */
115
+ efree (pathbuf );
116
+ return FAILURE ;
117
+ }
113
118
if (php_check_open_basedir_ex (ptr , 0 ) != 0 ) {
114
119
/* At least one portion of this open_basedir is less restrictive than the prior one, FAIL */
115
120
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