相信很多人都知道%00截断以及利用(./)来截断,但是在php5.3版本之后,这两种手段都失效了。但是,在这里我想介绍一种伪截断的方式来实现文件阶段。
后台源代码:
<?php
include $_GET['a'].php;
?>
建立一个1.txt的文件:
<?php
phpinfo();
?>
我使用的是php7.0的版本,因此%00阶段已经失效。如下图:


于是在此处使用(?)来实现伪截断,原理是:
test.php?a=http://localhost/1.txt?
Webserver把(?)后面的内容当作请求的参数,而1.txt不在Webserver里面解析。
因此,指定一下:

发现
http://127.0.0.1/test.php?a=1.txt?
不能成功。然而,换一种方式http://127.0.0.1/test.php?a=http://localhost/1.txt?

发现成功执行了截断。
网友评论