Hacking and Securing Oracle
Hacking and Securing Oracle
Insight Consulting
Introduction
My name is Pete Finnigan I specialise in researching, auditing and securing Oracle databases I am going to keep it reasonably simple and not too technical Lots of examples and demonstrations Try the hands-on examples on your own laptop? What do I want you to learn? Think like a hacker Know why and how data is vulnerable
Insight Consulting
Agenda
The problems / issues why Oracle can be insecure Where to find information Demonstrations of how to exploit Oracle 9i and 10gR2 demonstration exploits Finding and auditing for security problems Some basic ideas to secure your Oracle database
Insight Consulting
The problems
Do you need to be a DBA or have DBA-like privileges to Gain extra privileges? To perform application operations that you should not? To steal data? Extra privileges does not always mean system privileges Application operations do not need DBA privileges Stealing data or any type of hacking could be done as Mrs Smith Not Mr DBA There are also myriads of single privileges that can lead to problems The key is to remember that, in some circumstances, any privilege gained by a hacker or used by a hacker could be an issue
Insight Consulting
Insight Consulting
October 2006 CPU has large number of remote exploits, Jan 2007 and April 2007 have smaller numbers, April 2007, DB01 not released for Windows Two recent versions of an Oracle worm The threat of a much better rootkit BH 2006 Las Vegas Oracle suggested immediate patching because of DB18
Anyone can become DBA Demonstration
Similar issues with Oct 2006 CPU because of APEX Researchers are looking at SQL Injection techniques, TNS, unwrapping, forensics and much more
Insight Consulting
Investigating Role => DBA (PWD = NO) which is granted to => ==================================================================== User => SYS (ADM = YES) User => SCOTT (ADM = NO) User => WKSYS (ADM = NO) User => CTXSYS (ADM = NO) User => SYSTEM (ADM = YES) PL/SQL procedure successfully completed.
http://www.petefinnigan.com/who_has_role.sql
Demo
Insight Consulting
Insight Consulting
Insight Consulting
Insight Consulting
Insight Consulting
Insight Consulting
File system access plus OS functions Too many methods to access the file system
UTL_FILE,DBMS_BACKUP_RESTORE, EMD_SYSTEM, DBMS_LOB, DBMS_NAMESPACE, DBMS_SCHEDULER, Java (over 40) more
Insight Consulting
Password cracking
What is a password cracker Brute force and dictionary attacks Until recently the Oracle password algorithm was not public Before this we had to use PL/SQL based crackers C based crackers are now available free and commercial Orabf from http://www.toolcrypt.org/index.html?orabf is fast 1,100,000 hashes per second on 2.8ghz Pentium 4 Now version 0.7.5 Minimum password lengths are now even more important Do not let password hashes fall into hacker hands
Insight Consulting
Demo
Insight Consulting
Demo
Function created.
Insight Consulting
Insight Consulting
DBMS_EXPORT_EXTENSION - output
Create user PXF SQL> @exp Connected. grant create session and create Grant succeeded. procedure Connected. Package created. Run the hack, become a DBA Package body created. PL/SQL procedure successfully completed.
USERNAME GRANTED_ROLE ADM DEF OS_ -------- ------------ --- --- -PXF DBA NO YES NO SQL>
Insight Consulting
Insight Consulting
Insight Consulting
Insight Consulting
Demo - lsnrcheck
Insight Consulting
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener
Insight Consulting
Insight Consulting
PL/SQL Unwrapping
PL/SQL can be unwrapped Un-wrappers are available on the black market / black hat How do they work? 9i and lower is based on DIANA 10g is a new algorithm mechanism provided The contents of symbol table are no longer visible The encryption involves base64 forum post 10gR2 provides the ability to wrap from within the database using DBMS_DDL
Insight Consulting
Insight Consulting
procedure
Demo
Insight Consulting
Insight Consulting
Insight Consulting
Summary / Conclusions
Security is just common sense Oracle is big and complex too much to look at? Understand how a hacker thinks this is important Install what is needed not what can be installed Audit users passwords and use password management Audit for configuration issues / privileges regularly Expose only the privileges that are needed Remember hackers do not just want to get DBA privileges Use Oracle auditing
Insight Consulting
Insight Consulting
www.siemens.co.uk/insight
+44 (0)1932 241000
Insight Consulting
Siemens Enterprise Communications Limited
Insight Consulting