Skip to content
statance
MenuClose
← All ports

Port 1521: Oracle Database (TNS listener)

High risk

Port 1521 is the default Oracle Database listener. Clients connect to it using the TNS protocol to reach a database service. It should not be reachable from the public internet.

Port
1521
Protocol
TCP
Service
Oracle Database (TNS listener)
Expose to internet?
No

Is port 1521 safe to open?

An exposed Oracle listener reveals version information and accepts login attempts against database accounts, some of which had well-known default passwords in older releases. Like any database, it should only be reachable by the applications that use it.

How to secure Oracle Database (TNS listener)

  • Restrict the listener to trusted clients with TCP.VALIDNODE_CHECKING and TCP.INVITED_NODES in sqlnet.ora.
  • Lock or remove default and sample accounts.
  • Apply Oracle Critical Patch Updates and use network encryption.

Check if port 1521 is open

Linux: what is listening on this port

sudo ss -tlpn | grep ':1521 '

Windows (PowerShell): what is listening

Get-NetTCPConnection -LocalPort 1521 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}

From another machine: is it reachable

nc -zv HOST 1521 # or nmap -p 1521 HOST # Windows Test-NetConnection HOST -Port 1521

Test the Oracle Database (TNS listener) service itself

tnsping HOST:1521

Restrict port 1521 in the firewall

Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:1521:1521) instead of relying on the host firewall.

ufw: allow only your private network, deny everyone else

sudo ufw allow from 10.0.0.0/8 to any port 1521 proto tcp sudo ufw deny 1521/tcp

firewalld: allow one source network only

sudo firewall-cmd --permanent --remove-port=1521/tcp sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="1521" protocol="tcp" accept' sudo firewall-cmd --reload

iptables

sudo iptables -A INPUT -p tcp --dport 1521 -s 10.0.0.0/8 -j ACCEPT sudo iptables -A INPUT -p tcp --dport 1521 -j DROP

Windows Firewall (PowerShell, as Administrator)

New-NetFirewallRule -DisplayName "Block 1521 from internet" -Direction Inbound -Protocol TCP -LocalPort 1521 -RemoteAddress Internet -Action Block

Monitor port 1521

Run a TCP port monitor against your public IP on port 1521: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.

Related ports

Port 1433Microsoft SQL ServerHigh risk
Port 3306MySQL / MariaDBHigh risk
Port 5432PostgreSQLHigh risk

FAQ

What is port 1521 used for?

Port 1521 is the default Oracle Database listener. Clients connect to it using the TNS protocol to reach a database service.

Is it safe to open port 1521?

Not to the public internet. An exposed Oracle listener reveals version information and accepts login attempts against database accounts, some of which had well-known default passwords in older releases. Like any database, it should only be reachable by the applications that use it.

Is port 1521 TCP or UDP?

Oracle Database (TNS listener) uses TCP on port 1521.

How do I check if port 1521 is open?

On the server, run sudo ss -tulpn | grep ':1521 ' (Linux) or Get-NetTCPConnection -LocalPort 1521 (Windows) to see what is listening. From another machine, run nc -zv HOST 1521 or Test-NetConnection HOST -Port 1521.

All ports →

Know the moment a port stops answering.

TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.