19.09.2017 Views

the-web-application-hackers-handbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

336 Chapter 9 n Attacking Data Stores<br />

(continued)<br />

Oracle:<br />

ORA-01722: invalid number<br />

ORA-01858: a non-numeric character was found where a<br />

numeric was expected<br />

MS-SQL: Msg 245, Level 16, State 1, Line 1<br />

Syntax error converting <strong>the</strong> varchar value ‘foo’ to a<br />

column of data type int.<br />

MySQL:<br />

Translation:<br />

(MySQL will not give you an error.)<br />

Your input doesn’t match <strong>the</strong> expected data type for <strong>the</strong> field. You<br />

may have SQL injection, and you may not need a single quote, so<br />

try simply entering a number followed by your SQL to be injected. In<br />

MS-SQL, you should be able to return any string value with this error<br />

message.<br />

Oracle:<br />

MS-SQL:<br />

MySQL:<br />

Translation:<br />

ORA-00923: FROM keyword not found where expected<br />

N/A<br />

N/A<br />

The following will work in MS-SQL:<br />

SELECT 1<br />

But in Oracle, if you want to return something, you must select from<br />

a table. The DUAL table will do fine:<br />

SELECT 1 from DUAL<br />

Oracle:<br />

MS-SQL:<br />

MySQL:<br />

Translation:<br />

ORA-00936: missing expression<br />

Msg 156, Level 15, State 1, Line 1Incorrect syntax<br />

near <strong>the</strong> keyword ‘from’.<br />

You have an error in your SQL syntax. Check <strong>the</strong><br />

manual that corresponds to your MySQL server version<br />

for <strong>the</strong> right syntax to use near ‘ XXX , YYY from<br />

SOME_TABLE’ at line 1<br />

You commonly see this error message when your injection point<br />

occurs before <strong>the</strong> FROM keyword (for example, you have injected<br />

into <strong>the</strong> columns to be returned) and/or you have used <strong>the</strong> comment<br />

character to remove required SQL keywords. Try completing <strong>the</strong><br />

SQL statement yourself while using your comment character. MySQL<br />

should helpfully reveal <strong>the</strong> column names XXX, YYY when this condition<br />

is encountered.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!