Oracle TNS
Pentesting Oracle TNS - TCP Ports 1521,1522-1529
Last updated
Was this helpful?
Pentesting Oracle TNS - TCP Ports 1521,1522-1529
Last updated
Was this helpful?
Oracle clients communicate with the database using the Transparent Network Substrate (TNS) protocol. When the listener receives a connection request (1521/TCP, -you may also get secondary listeners on 1522–1529-), it starts up a new database process and establishes a connection between the client and the Oracle database.
Using nmap scripts, we can enumerate the version of the TNS-Listener
When enumerating Oracle the first step is to talk to the TNS-Listener
If you receive an error, could be because TNS versions are incompatible (Use the --10G
parameter with tnscmd10
) and if the error persist, the listener may be password protected
We can use hydra to brute-force TNS-Listener password
The SID (Service Identifier) is essentially the database name, depending on the install you may have one or more default SIDs, or even a totally custom dba defined SID.
Once we have found a valid SID, the next step is account enumeration. From this point, you can connect to the listener and brute-force credentials.
If an account has system database priviledges (sysdba) or system operator (sysop) you may wish to try the following:
If an account has system database priviledges (sysdba) or system operator (sysop) you may add following args when using odat:
An interesting tool is oscanner, which will try to get some valid SID and then it will brute-force for valid credentials and try to extract some information:
We can brute-force SID using or
We can use or , or to bruteforce accounts on a known SID
Here are mixed wordlists taken from and some interesting other wordlists
Other default passwords can be found and
To login using known credentials, we can use
We can try to execute code using Java Stored Procedure
We can try to execute code using and Oracle Scheduler
We can try to execute code using and Oracle External Tables
ODAT requires the privilege ‘CREATE ANY DIRECTORY’, which, by default, is granted only to DBA role, since it attempts to execute the file from any and not only “your” directory ( of this attack requires less privileges).
We can try to read/write files using and utlfile
We can try to read files using and Oracle External Tables
We may use the module from odat to escalate our privileges on the DB. On that link you will find several ways to escalate privileges using odat.
Another tool that will do all of this is