Re:Sqlmap: Automatic SQL injection and database takeover tool
by bni on Thursday July 05, 2012 @12:47PM
(#4203761)
SP:s was never mentioned in the post you are replying to, but ofcourse if you use dynamic SQL in them (execute immediate in Oracle) it is just as bad as doing string concatenation in other languages. Just dont do that.
Re:Sqlmap: Automatic SQL injection and database takeover tool
by derpmeister on Thursday July 05, 2012 @03:26PM
(#4204540)
It would be a silly thing to do because you keep exactly the same problem you'd have without stored procedures. Would the client you're writing rather execute something along the lines of
SELECT sp_enroll("bob\"); DROP TABLE students; --");
or SELECT sp_enroll("bob"); DROP TABLE students; --");
?At least if you grant the user only SELECT and EXECUTE privileges and define the procedures using the SECURITY DEFINER property, you could still prevent this type of damage. (This relies on the procedures to be as strict as possible or the whole scheme essentially fails.)
The better answer is a parameterized query, which actually controls the inputs properly to ensure that no dynamic SQL is possible.