28.10.2014 Views

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

References • Chapter 10 443<br />

Table 10.19 Continued. Encoded <strong>SQL</strong> Metacharacters<br />

Character<br />

Encoded Variants<br />

) %29<br />

%2529<br />

%u0029<br />

%uff09<br />

%ef%bc%89<br />

[SPACE] %20<br />

%2520<br />

%u0020<br />

%ff00<br />

%c0%a0<br />

Troubleshooting <strong>SQL</strong> <strong>Injection</strong> <strong>Attacks</strong><br />

Table 10.20 lists some of the common challenges <strong>and</strong> errors that are frequently encountered<br />

when attempting to exploit an <strong>SQL</strong> injection flaw across various platforms.<br />

Table 10.20 Troubleshooting <strong>SQL</strong> <strong>Injection</strong> Reference<br />

Error/Challenge<br />

Challenge<br />

Performing a UNION SELECT<br />

attack where the original<br />

query is retrieving a column<br />

of type image<br />

Error Message<br />

Image is incompatible<br />

with int /<br />

The image data type cannot<br />

be selected as DISTINCT<br />

because it is not comparable.<br />

Challenge<br />

Injecting into an ORDER BY<br />

clause<br />

Solution<br />

Change your UNION SELECT statement to<br />

read UNION ALL SELECT. This resolves the<br />

problem with UNION SELECT attempting to<br />

perform a compare operation against an<br />

image data type.<br />

For example:<br />

UNION ALL SELECT null, null, null<br />

Microsoft <strong>SQL</strong> Server<br />

Microsoft <strong>SQL</strong> Server supports stacked<br />

queries using the semicolon character (;) to<br />

begin each new query. A variety of attacks,<br />

such as time-delay-based data retrieval <strong>and</strong><br />

Continued

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

Saved successfully!

Ooh no, something went wrong!