I'm currently working on a legacy ASP project where security has now become a large concern. Not only is it insecure encryption methods (md5), but I'm worried about SQL injection problems. I'm not very good with injection quite yet, and I've tried only the basics of what I know. I've found the function which "secures" any user input, but I'm wondering if it is actually doing anything to prevent injection attacks. Here is the function:
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
I remember doing something like this many years ago when I first started PHP with mysql_* functions, but now I've moved onto PDO and parameter binding. However I don't know how safe this is for ASP applications. Thanks for any input.