我目前正在开发一个传统的ASP项目,其中安全性现在已成为一个大问题.它不仅是不安全的加密方法(md5),而且我担心SQL注入问题.我对注射效果还不是很好,而且我只尝试过我所知道的基础知识.我发现了“保护”任何用户输入的功能,但我想知道它是否真的做了什么来防止注入攻击.这是功能:
function sqlfix(input)
if not isnull(input) and input <> "" then
input = replace(input, ";", ";")
input = replace(input, "'", "'")
input = replace(input, """", """)
input = replace(input, "(", "(")
input = replace(input, ")", ")")
input = replace(input, "|", "|")
input = replace(input, "
input = replace(input, ">", ">")
input = replace(input , "'", "''")
'input = Server.HTMLEncode(input)
'input = Server.UrlEncode(input)
sqlfix = input
else
sqlfix = ""
end if
end function
我记得在很多年前我第一次使用mysql_ *函数启动PHP时做了类似的事情,但现在我已经转向了PDO和参数绑定.但是我不知道这对ASP应用程序有多安全.感谢您的任何意见.