【原创】DuomiCms多处SQL注入打包

全局都使用dede的防注入函数,这个就留给大家去想办法了。。

我们跟踪到

duomimembermember.php

}elseif($action=='chgpwdsubmit')
{
	if(trim($newpwd)<>trim($newpwd2))
	{
		ShowMsg('两次输入密码不一致','-1');	
		exit();	
	}


	if(!empty($newpwd)||!empty($email))
	{
	$pwd = empty($newpwd)?substr(md5($oldpwd),5,20):substr(md5($newpwd),5,20);
	$dsql->ExecuteNoneQuery("update `duomi_member` set password = '$pwd' ".(empty($email)?'':",email = '$email'")." where id= '$uid'");
	ShowMsg('密码修改成功','-1');	
	exit();	
	}
		

  更改密码处可以看到都被单引号了。

但是下面的全部没有进行单引号。

elseif($action=='cancelfav')
{
	$dsql->executeNoneQuery("delete from duomi_favorite where id=".$id);//一处
	echo "<script>location.href='?action=favorite'</script>";
	exit();
}elseif($action=='cancelfavs')
{
	if(empty($fid))
	{
		showMsg("请选择要取消收藏的视频","-1");
		exit();
	}
	foreach($fid as $id)
	{
		$dsql->executeNoneQuery("delete from duomi_favorite where id=".$id);//二处
	}
	echo "<script>location.href='?action=favorite'</script>";
	exit();
}elseif($action=='favorite')
{
	$pcount = 1;
	$row=$dsql->getOne("select count(id) as dd from duomi_favorite where uid=".$uid);//三处
	$rcount=$row['dd'];
	if($rcount==0)
	{
		echo "<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="center">没有收藏的视频</td></tr></table>";
		exit();
	}	
	$dsql->setQuery("select * from duomi_favorite where uid=".$uid." limit ".($pg-1)*$pcount.",$pcount");
	$dsql->Execute('favlist');
?>

  三处都可控,也没有单引号引入,看看SQL执行。

现在引入我们的语句

已经进去了。

利用如下:

post:

http://localhost/member/member.php?action=cancelfav

id=1 SQL注入

可以直接扔SQLMAP了。

原文地址:https://www.cnblogs.com/blck/p/5126494.html