That is why you need to use precompiled statements in databases. Because if you do not, then this will work. Note the "'" in the string? If you simply throw this into the database, even if you say that you only want to insert this string, then the process is prone to such escape char attacks. You end up first inserting part of it and then executing the rest of the string.kpa said:On the surface this looks like a very creative way to do an SQL injection attack. However, it's a real stretch to assume that the text that is OCR'ed from the picture is ever used in an execution context as SQL program code.
kpa said:Guess I'm old or something but using completely on the fly created SQL code would be the last thing to come to my mind when developing something like the system here in question.
kpa said:On the surface this looks like a very creative way to do an SQL injection attack. However, it's a real stretch to assume that the text that is OCR'ed from the picture is ever used in an execution context as SQL program code.
I understand. (I am also old). I come from a mainframe DB2 database environment, and I don't even think there is way to not use precompiled SQL statements. (I can't speak for Linux and Windows DB2; I haven't worked with them.) Nonetheless, there are a ton of PHP/MySQL web frontends that take the input data, concatenate stuff with it to make an SQL statement, and run it. There are tools in PHP to sanitize inputs, but they are not always used, and I believe they are not infallible.Guess I'm old or something but using completely on the fly created SQL code would be the last thing to come to my mind when developing something like the system here in question.