Programmare in ASP: Blacklist per difendersi da sql injection
Spesso gli attacchi di sql injection ci colpiscono bypassando la semplice pulitura in request
campo = replace ( request ( ” nome_campo ” ) , ” ‘ “,” ‘ ‘ “)
L’implementazione del seguente codice in ASP previene da possibili attacchi di sql injection:
if not isArray(BlackList) then
redim BlackList(32)
BlackList = Array("/*", "*/", "@@", _
"declare", "delete", "drop", "exec",_
"execute", "fetch", "insert", "kill", "open",_
"select", "sys", "sysobjects", "syscolumns",_
"table", "update", "script", "xp_", "555044415445",_
"757064617465", "736372697074", "534352495054",_
"65786563", "45584543", "696E73657274", "494E53455254",_
"64656C657465", "44454C455445", "varchar")
end if
if (request.QueryString <> "")then ferma = false for i = 0 to ubound(BlackList) if instr(1,Ucase(request.QueryString),Ucase(BlackList(i))) <> 0 then response.end end if next end if
Questa procedura è consigliata posizionarla all’interno di un file presente su tutte le pagine, e controllerà tutti i valori passati in querystring
Articoli correlati
VEDI ANCHE:























































Commenti recenti