Wolves Security Team

Unfortunately no one can be told what W.S.T is - you have to see it for yourself.

You are not logged in.

Announcement

欢迎cnryan同学加入狼族:-)

Follow Wolves Security Team Official Google Buzz!

#1 2008-11-03 19:32:37

puret_t
Administrator
Registered: 2008-10-05
Posts: 86

关于PHP的本地包含

by Ryat
http://www.wolvez.org
2007-12-17

利用本地包含时常常需要用%00来截断后面的字符串,但在GPC为ON时%00是会被转义的,那么还有其他方法么?

其实以前就有人提到过用一定数量的/突破操作系统对文件名的长度限制来截断后面的字符串,详见:http://cloie.it580.com/?p=51

文里提到只可以在WIN下利用,其实部分Linux主机下也可以,只是/的数量要更多些[要使文件路径名长度大于4096字节],看看下面的代码片断:

<?php
$a='';
for($i=0;$i<=4071;$i++) {
    $a .= '/';
}
$a = 'test.txt'.$a;                   //完整的路径为/var/www/test/test.txt
require_once($a.'.php');
?>

在Linux环境下测试,你会发现'.php'被截断了,成功的包含了test.txt:)

Offline

Board footer

Powered by FluxBB