SQL injection ASP Güvenlik

0
Onaylı Üye
Üye
Katılım
28 Eylül 2004
Mesajlar
896
SQL injection mssql için ne gibi güvenlik önlemleri almalıyız.. Bu aralar çok konuşalan bir konu haline geldi..

Hela asp mssql de çok tehlikeli bir durum.

<%
function strkoru(strsorgu)
strsorgu=Replace(strsorgu,"'" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"<" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,">" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"%" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"-" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"+" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"union" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"update" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"select" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"where" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"delete" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"insert" ,"%replace%" , 1, -1, 1)
strsorgu=Replace(strsorgu,"drop" ,"%replace%" , 1, -1, 1)
If InStr(1,strsorgu,"%replace%" ,1) Then
response.redirect "/"
End If
strkoru=Trim(strsorgu)
End Function %>

Yukardaki Function ile ne kadar koruma sağlanabilir asp ciler ne yapıyor mssql kulananlar bu konuda.
 
0
Onaylı Üye
Üye
Katılım
24 Ocak 2005
Mesajlar
1,667
id sorgularını ve bu replace olayını ayrıca bir yöntem daha var onuda yaptığın zaman dql injeksiyon senden korksun..
 
0
Onaylı Üye
Üye
Katılım
1 Şubat 2005
Mesajlar
3,367
<%function guvenlik(veri)
veri = Replace (veri ,"`","",1,-1,1)
veri = Replace (veri ,"=","",1,-1,1)
veri = Replace (veri ,"&","",1,-1,1)
veri = Replace (veri ,"%","",1,-1,1)
veri = Replace (veri ,"!","",1,-1,1)
veri = Replace (veri ,"#","",1,-1,1)
veri = Replace (veri ,"<","",1,-1,1)
veri = Replace (veri ,">","",1,-1,1)
veri = Replace (veri ,"*","",1,-1,1)
veri = Replace (veri ,"/","",1,-1,1)
veri = Replace (veri ,"\","",1,-1,1)
veri = Replace (veri ,"'","",1,-1,1)
veri = Replace (veri ,"-","",1,-1,1)
veri = Replace (veri ,"'","",1,-1,1)
veri = Replace (veri ,"^","",1,-1,1)
veri = Replace (veri ,"select","",1,-1,1)
veri = Replace (veri ,"update","",1,-1,1)
veri = Replace (veri ,"join","",1,-1,1)
veri = Replace (veri ,"delete","",1,-1,1)
veri = Replace (veri ,"alter","",1,-1,1)
veri = Replace (veri ,"create","",1,-1,1)
veri = Replace (veri ,"drop","",1,-1,1)
guvenlik=veri
end function%>

<%id= guvenlik(request.querystring("id"))%>
Formlar için
<%username= guvenlik(request.form("username"))
password= guvenlik(request.form("password"))%>

Bende bu şekilde kullanıyorum. En sık gelecek saldırılar tahminimce bunlar.
Ve aynı şekilde bu kontrolü formlardan alınan verilerde de yapmak gerekli.
Numeric kontrol malesef yetersiz kalıyor.
 
0
Onaylı Üye
Üye
Katılım
28 Eylül 2004
Mesajlar
896
sorun zaten bide bunların hex ve ascii kodları ilede yapılabileceği buyüzden sayfalardaki kod miktarı artıyor.
 
Geri
Üst