对VAuditDemo的审计<2>

对网站的入口文件,配置文件,自定义防护函数,还有网站的整个架构了解后。开始分析敏感函数。

首先搜索到了exec_shell

path:  ../admin/ping.php

 1 <?php
 2             if( isset( $_POST[ 'submit' ] ) ) {
 3                 $target = $_POST[ 'target' ];
 4 
 5                 if (stristr(php_uname('s'), 'Windows NT')) { 
 6                     $cmd = 'ping ' . $target;
 7                 } else { 
 8                     $cmd = 'ping -c 3 ' . $target;
 9                 }
10                 $res = shell_exec( $cmd );
11                 echo "<br /><pre>$cmd
".iconv('GB2312', 'UTF-8',$res)."</pre>";
12             }
13             ?>

发现该函数在admin目录下的ping.php中,因为是白盒审计,可以先给管理员要一个测试账号,方便测试!

获取系统类型: php_uname('s')    stristr()判断系统类型是否为Windes NT

输入正常的ip

最终都没有对target进行过滤,所以去尝试突破

成功执行了系统命令!

修复建议:应该将接受到的targrt数据,进行过滤。(过滤的参数有  | 、 || 、 &、 &&、等)

原文地址:https://www.cnblogs.com/pojun/p/7301459.html