最近又有用户的SQL出现数据混乱,数据中有SELECT等情况,可能是一句话木马引起的,特加入防木马注入.
摘自:孤行一鬼
If Request.Form<>"" Then StopInjection(Request.Form)
If Request.QueryString<>"" Then StopInjection(Request.QueryString)
If Request.Cookies<>"" Then StopInjection(Request.Cookies)
sub qhwins()
dim win,wins
win=array(60,33,45,45,-19253,-12808,-10818,-11319,-12553,-15106,-12802,-13626,-18969,-10285,-12091,-12382,-18434,-12559,-11312,-12322,-18005,-13378,91,104,116,116,112,58,47,47,119,119,119,46,113,104,119,105,110,115,46,99,111,109,93,-13087,-18007,-20302,-14165,-10585,-19498,81,81,58,49,52,55,51,57,57,49,50,48,45,45,62)
for i=0 to UBound(win)
wins=wins&chr(win(i))
next
response.Write(wins)
end sub
Function Stop_Inj(str)
dim BadStr,myarry
str=lcase(str)
'BadStr = "and|(|)|exec|insert|select|delete|update|count|chr|mid|master|truncate|cmd|char|declare|'|;|~|!|#|$|^|*|/|’|‘|"&chr(34)&""
BadStr = "and|(|)|exec|insert|select|delete|update|count|chr|mid|master|truncate|cmd|char|declare|'|;|~|!|#|$|^|*|/|’|‘|"&chr(34)&""
myarry=split(BadStr,"|")
for i=0 to ubound(myarry)
if instr(str,myarry(i))>0 then
response.Write("本站友情提醒您^_^:请不要在提交参数:"&str&"中包含如下字符:"&myarry(i)&"
以免影响您对本站的正常访问!")
'response.Write("")
response.End()
end if
next
end function
Sub StopInjection(Values)
Dim sItem, sValue
For Each sItem In Values
sValue = Values(sItem)
call Stop_Inj(sValue)
Next
call qhwins
End Sub
sub buyok_check_path()
server_v1=lcase(Cstr(Request.ServerVariables("HTTP_REFERER")))
server_v2=lcase(Cstr(Request.ServerVariables("SERVER_NAME")))
if mid(server_v1,8,len(server_v2))<>server_v2 then
response.write ""
response.end
end if
end sub