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 44
55- Core:
66 . Fixed bug #81068 (Double free in realpath_cache_clean()). (Dimitry Andric)
7+ . Fixed bug #76359 (open_basedir bypass through adding ".."). (cmb)
78
89- Standard:
910 . 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)
110110 * end = '\0' ;
111111 end ++ ;
112112 }
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+ }
113118 if (php_check_open_basedir_ex (ptr , 0 ) != 0 ) {
114119 /* At least one portion of this open_basedir is less restrictive than the prior one, FAIL */
115120 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