Proving SQL Injection

后端 未结 5 1078
旧巷少年郎
旧巷少年郎 2021-01-01 01:24

I\'m trying to simply prove here that this simple function isn\'t good enough to prevent every sql injection in the world:

Function CleanForSQL(ByVal input A         


        
5条回答
  •  佛祖请我去吃肉
    2021-01-01 02:04

    Your CleanForSQL method only handles string situations. What happens when you're not using a string but an INT instead? In that case, there would be no end tick to close with, so the injection would still happen. Consider this example...

    Database.DBUpdate("UPDATE tblFilledForms SET Int1 = " + CleanForSQL(txtNote.Text) + " WHERE FilledFormID = " + DGVNotes.SelectedRows(0).Cells("FilledFormID").Value.ToString)
    

    in that case, just entering the following will work...

    0; update tblMaint SET Value1 = 2 WHERE ValueID = 2--

提交回复
热议问题