(A) ID=49 这类注入的参数是数字型,SQL语句原貌大致如下: Select * from 表名 where 字段=49 注入的参数为ID=49 And [查询条件],即是生成语句: Select * from 表名 where 字段=49 And [查询条件]
(B) Class=连续剧 这类注入的参数是字符型,SQL语句原貌大致概如下: Select * from 表名 where 字段=’连续剧’ 注入的参数为Class=连续剧’ and [查询条件] and ‘’=’ ,即是生成语句: Select * from 表名 where 字段=’连续剧’ and [查询条件] and ‘’=’’
(C) 搜索时没过滤参数的,如keyword=关键字,SQL语句原貌大致如下: Select * from 表名 where 字段like ’%关键字%’ 注入的参数为keyword=’ and [查询条件] and ‘%25’=’, 即是生成语句: Select * from 表名 where字段like ’%’ and [查询条件] and ‘%’=’%’
Function SafeRequest(ParaName,ParaType) ‘--- 传入参数 --- ‘ParaName:参数名称-字符型 ‘ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符)
Dim ParaValue ParaValue=Request(ParaName) If ParaType=1 then If not isNumeric(ParaValue) then Response.write "参数" & ParaName & "必须为数字型!" Response.end End if Else ParaValue=replace(ParaValue,"‘","‘‘") End if SafeRequest=ParaValue End function