新手入門:防范SQL注入攻擊的新辦法
作者:佚名
以下的文章主要描述的是新手入門之防范SQL注入攻擊的好用辦法,在實際操作中可能會有會給用戶帶來不便,以下的文章就是相關(guān)破解方案的介紹。
此文章主要向大家描述的是正確防范SQL注入攻擊的好用方案,近段時間由于修改一個ASP程序(有SQL注入漏洞),在網(wǎng)上找了一些防范辦法,可執(zhí)行性都不咋地,所以我將現(xiàn)在網(wǎng)上的一些方法綜合改良了一下,寫出這個ASP函數(shù),供大家參考。
以下是引用片段:
- Function SafeRequest(ParaName)
- Dim ParaValue
- ParaValue=Request(ParaName)
- if IsNumeric(ParaValue) = True then
- SafeRequest=ParaValue
- exit Function
- elseIf Instr(LCase(ParaValue),"select ") > 0 or Instr(LCase(ParaValue),"insert ")
> 0 or Instr(LCase(ParaValue),"delete from") > 0 or Instr(LCase(ParaValue),"count(")
> 0 or Instr(LCase(ParaValue),"drop table") > 0 or Instr(LCase(ParaValue),"update ")
> 0 or Instr(LCase(ParaValue),"truncate ") > 0 or Instr(LCase(ParaValue),"asc(") > 0
or Instr(LCase(ParaValue),"mid(") > 0 or Instr(LCase(ParaValue),"char(") > 0 or
Instr(LCase(ParaValue),"xp_cmdshell") > 0 or Instr(LCase(ParaValue),"exec master")
> 0 or Instr(LCase(ParaValue),"net localgroup administrators") > 0 or Instr(LCase(ParaValue)," and ")
> 0 or Instr(LCase(ParaValue),"net user") > 0 or Instr(LCase(ParaValue)," or ") > 0 then
- Response.Write "<script language='javascript'>"
- Response.Write "alert('非法的請求!');" '
發(fā)現(xiàn)SQL注入攻擊提示信息
Response.Write "location.發(fā)現(xiàn)SQL注入攻擊轉(zhuǎn)跳網(wǎng)址
- Response.Write "<script>"
- Response.end
- else
- SafeRequest=ParaValue
- End If
- End function
使用SafeRequest函
上述的相關(guān)內(nèi)容就是對新手入門:防范SQL注入攻擊的新辦法
的描述,希望會給你帶來一些幫助在此方面。
【編輯推薦】
責(zé)任編輯:佚名
來源:
博客園