What characters have to be escaped to prevent (My)SQL injections?

A guess concerning the backspace character: Imagine I send you an email “Hi, here’s the query to update your DB as you wanted” and an attached textfile with

INSERT INTO students VALUES ("Bobby Tables",12,"abc",3.6);

You cat the file, see it’s okay, and just pipe the file to MySQL. What you didn’t know, however, was that I put

DROP TABLE students;\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b

before the INSERT STATEMENT which you didn’t see because on console output the backspaces overwrote it. Bamm!

Just a guess, though.

Edit (couldn’t resist):

alt text

Leave a Comment