knowledge

Overview

Oracle TNS (Transparent Network Substrate) is Oracle’s proprietary communication protocol for connecting Oracle Database clients to server instances over a network. It supports TCP/IP, UDP, IPv6, and SSL/TLS and is the default listener protocol on TCP/1521. Oracle TNS is common in enterprise healthcare, finance, and retail environments. Misconfigurations in tnsnames.ora and weak default credentials (especially the dbsnmp account) make Oracle databases attractive targets during external and internal assessments.


Terminology

TermDefinition
TNSTransparent Network Substrate — Oracle’s proprietary database network protocol
Oracle Net ServicesSuite that includes TNS; manages name resolution, load balancing, and security
tnsnames.oraClient-side config file listing service names, hosts, ports, and connection details
listener.oraServer-side config defining the listener process that receives incoming TNS connections
SIDSystem Identifier — unique identifier for an Oracle database instance
Service NameAlternative to SID; identifies the database globally; preferred in modern Oracle
ODATOracle Database Attacking Tool — open-source tool for enumerating and exploiting Oracle databases
SQLplusOracle command-line SQL client for interacting with Oracle databases
sysdbaSystem DBA role — highest privilege level in Oracle; equivalent to root access
PL/SQL Exclusion ListBlacklist of PL/SQL packages/types blocked from execution via Oracle Application Server
DBSNMPDefault Oracle monitoring account; default password: dbsnmp

Core Concepts

Protocol Overview

Oracle TNS was introduced with Oracle Net Services and supports:

  • TCP/IP (most common), UDP, IPX/SPX, AppleTalk
  • Built-in encryption via Oracle Net Services (client-server layer over TCP/IP)
  • Listener on TCP/1521 by default
  • IPv6 and SSL/TLS in modern versions

The listener receives incoming connection requests and forwards them to the appropriate database instance. Connection details (service name, host, port) are stored in tnsnames.ora on the client.

Remotely manageable only in older versions (Oracle 8i/9i); not in 10g/11g.


Configuration Files

Located in $ORACLE_HOME/network/admin/:

FileSidePurpose
tnsnames.oraClientMaps service names to connection descriptors (host, port, SID/service name)
listener.oraServerDefines listener process parameters — ports, protocols, SID list

Key tnsnames.ora settings:

ParameterDescription
DESCRIPTIONDescriptor providing a name for the database and connection type
ADDRESSHost and port for network communication
USERUsername for connection (when included)
PASSWORDPassword for connection (when included)
PROTOCOLNetwork protocol used (TCP, TCPS, etc.)
SID or SERVICE_NAMETarget database instance identifier
CONNECT_TIMEOUTConnection timeout in seconds
FAILOVERWhether to try other addresses on failure

Default Credentials

AccountDefault PasswordNotes
syschange_on_install (Oracle 9)No default in Oracle 10+
systemmanager (Oracle 9)No default in Oracle 10+
dbsnmpdbsnmpOracle monitoring account; often not changed
scotttigerClassic demo/test account; often present in labs

Dangerous Settings

SettingRisk
Default credentials not changeddbsnmp, scott/tiger widely known
listener.ora no passwordListener can be administered without authentication
Writable PL/SQL Exclusion List directoryBlacklist can be modified to enable restricted packages
Webshell upload to web rootIf web server runs on same host, ODAT can upload shells

Footprinting Oracle TNS

Scan port 1521 with Nmap (-sV --open). The oracle-sid-brute NSE script brute-forces valid SID names from a wordlist. See Nmap for full script reference.

Perform a full enumeration scan (SIDs, versions, users, vulnerabilities) with ODAT.


Connecting with SQLplus

Connect using the sqlplus <user>/<password>@<target>/<service-name> syntax. Append as sysdba if the account holds the sysdba privilege. See SQLplus for installation and full connection syntax.

Common Queries

QueryPurpose
select table_name from all_tables;List all accessible tables
select * from user_role_privs;Show current user’s roles and privileges
select name, password from sys.user$;Retrieve password hashes for offline cracking (requires sysdba)

For installation steps and library dependency fixes, see SQLplus.


Webshell Upload via ODAT

If a web server runs on the same host, the utlfile module in ODAT can write files directly to the web root (/var/www/html on Linux, C:\inetpub\wwwroot on Windows). See ODAT for the full webshell upload workflow.


  • Service Enumeration

References / Images