新手入门:防范SQL注入攻击的新办法

新手入门:防范SQL注入攻击的新办法,第1张

新手入门:防范SQL注入攻击的新办法,第2张

最近由于一个ASP程序的修改(带有SQL注入漏洞),我在网上找了很多相关的防范措施,但都不尽如人意,所以综合改进了现在网上的一些方法,写了这个ASP功能,供大家参考。

下面是一段引文:
函数安全请求(paraname)
dimparavalue
ParaValue =请求(paraname)
if为数值(ParaValue)= true then
safe request = ParaValue
exit函数
else if Instr(LCase(ParaValue)," select ") > 0或Instr(LCase(ParaValue)," insert))> 0或Instr(LCase(ParaValue)," delete from))> 0或inst " xp_cmdshell") > 0或Instr(LCase(ParaValue)," exec master") > 0或Instr(LCase(ParaValue)," net local group administrator ")> 0或Instr(LCase(ParaValue)," and ") > 0或Instr(LCase(ParaValue)," net user))> 0或Instr(LCase(ParaValue)," or ")> 0然后
response . write " "
response . write " alert('非法请求!' );" '发现SQL注入攻击的提示消息
response . write " location . href = ' http://dev.yesky.com/';" URL
response . write " "
response . end
else
safe request = para value
end if
找到end函数。


使用SafeRequest函数替换您的请求。

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 新手入门:防范SQL注入攻击的新办法

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情