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.

SELECT name,spare4 FROM sys.user$ where type#>0 <strong>and</strong> length(spare4)=62<br />

SYS<br />

S:1336FB26ACF58354164952E502B4F726FF8B5D382012D2E7B1EC99C426A7<br />

SYSTEM<br />

S:38968E8CEC12026112B0010BCBA3ECC2FD278AFA17AE363FDD74674F2651<br />

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

If the current user is a privileged one, or access as a privileged user has been obtained,<br />

you can look for a number of other interesting pieces of information in the database<br />

structure. Since Oracle 10g Rel. 2, Oracle offers the capability of transparently encrypting<br />

columns in the database. Normally, only the most important or sensitive tables will be<br />

encrypted, <strong>and</strong> therefore you are interested in finding these tables as follows:<br />

select table_name,column_name,encryption_alg,salt from<br />

dba_encrypted_columns;<br />

TABLE_NAME COLUMN_NAME ENCRYPTION_ALG SAL<br />

---------------------------------------------------------------------------<br />

CREDITCARD CCNR AES256 NO<br />

CREDITCARD CVE AES256 NO<br />

CREDITCARD VALID AES256 NO<br />

Another piece of information that could be useful, if you have a privileged account,<br />

is to know what database administrator (DBA) accounts exist within the database, as follows:<br />

Select grantee,granted_role,admin_option,default_role from dba_role_privs<br />

where granted_role='DBA';<br />

Tip<br />

Enumerating a full database by h<strong>and</strong> can be a very tedious task. Although<br />

it can be fairly easy to quickly code a small program to perform the task for<br />

you (using your favorite scripting language), several free tools are available<br />

that automate the process. At the end of this chapter, three of them: sqlmap,<br />

Bobcat, <strong>and</strong> bsql will be illustrated.<br />

Escalating Privileges<br />

All modern DBMSs provide their administrators with very granular control over the actions<br />

that users can perform. You can carefully manage <strong>and</strong> control access to the stored<br />

information by giving each user very specific rights, such as the ability to access only<br />

specific databases <strong>and</strong> perform only specific actions on it. Maybe the back-end DBMS that<br />

you are attacking has several databases, but the user who performs your queries might have<br />

access to only one of them, which might not contain the most interesting information.

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

Saved successfully!

Ooh no, something went wrong!