Skip to main content
Default Ports: 1521 (TNS Listener), 1630 (iSQL*Net) Oracle is the enterprise database you’ll mostly run into in large corporations and government environments, usually holding exactly the kind of sensitive data that makes it worth the extra effort. It’s also considerably more involved to attack than MySQL or MSSQL: connecting requires knowing a SID (System Identifier) up front, not just a hostname, and that extra layer is itself worth enumerating before anything else.

TNS Listener

The gateway every connection passes through first. It needs the right SID before the actual database login even happens, which makes SID discovery a required step, not an optional one.

Database Session

Once connected with a valid SID and credentials, Oracle’s own PL/SQL and Java execution features open up command execution, file access, and SSRF directly from SQL.
ODAT (Oracle Database Attacking Tool) automates almost everything on this page, SID brute-forcing, credential testing, privilege checks, file upload, in one tool. Worth running early as a broad first pass: github.com/quentinhardy/odat

Connecting

Running a single query without an interactive session, useful for scripting or a quick check:
If sqlplus fails with error while loading shared libraries: libsqlplus.so: cannot open shared object file, the Oracle Instant Client libraries aren’t on the linker path. Add the Instant Client directory to LD_LIBRARY_PATH (or ldconfig it) before running sqlplus again.
odat all runs sidguessing, default credential testing, and a broad privilege/vulnerability check against the target in one pass, the single most useful first command against an unknown Oracle target.

Recon and SID Enumeration

Unlike MySQL or MSSQL, Oracle requires a valid SID before you can even attempt a login, which makes guessing it a required enumeration step rather than an optional one.
Common default SIDs worth trying even without a wordlist: ORCL, XE, XEXDB, PROD, DEV, TEST.

Default and Weak Credentials

Oracle installs frequently retain well-known default accounts, worth testing before any brute-force attempt.

Brute Forcing


Manual Enumeration


File Upload and Read/Write

The same read/write capability works directly from SQL through UTL_FILE, without needing ODAT:

Command Execution via Java

This requires Java execution permissions to be granted first, usually meaning you already have significant privileges. A successful run means full OS command execution as the Oracle service account.
Oracle can compile and run Java code directly inside the database, which, combined with a PL/SQL wrapper, gives arbitrary command execution.
1

Grant the necessary Java permissions

2

Create a Java class that runs OS commands

3

Wrap it in a callable PL/SQL function

4

Execute commands


Network Operations (SSRF and Exfiltration)

Oracle’s UTL_* packages make outbound network requests directly from SQL, useful for SSRF against internal services or simple data exfiltration when direct file access isn’t available.

Password Hash Extraction and Cracking


Privilege Escalation and Persistence

Creating accounts or granting DBA are high-impact, easily audited actions. Confirm scope explicitly covers this before going beyond enumeration.

Useful PL/SQL Packages

PackageCapability
DBMS_JAVAJava execution, the basis for OS command execution
UTL_FILERead and write files on the server
UTL_HTTPOutbound HTTP requests, useful for SSRF
UTL_TCPRaw TCP connections, usable for port scanning
UTL_INADDRDNS resolution, useful for blind exfiltration
UTL_MAILSend email directly from the database
DBMS_SCHEDULERSchedule jobs, a persistence mechanism

Quick Reference Tools

Hackviser: Oracle

Quick-reference pentesting guide for Oracle Database.

HackTricks: Oracle Listener

Deeper breakdown of TNS Listener enumeration and exploitation.

ODAT

Oracle Database Attacking Tool, automates most of the techniques on this page.

Oracle SQL*Plus Reference

Official command reference for SQL*Plus.
Java-based command execution, file writes, and account creation are all high-impact actions capable of fully compromising the host. Confirm scope before going past read-only enumeration.