CyberHunter
// Databases & caches

Port 9042: Cassandra

Apache Cassandra native protocol.

9042

How Cassandra works

Databases & caches
app:9042CQL SELECTTLS only if enabled app:9042CQL SELECTTLS only if enabled

The application sends a SQL query to the Cassandra server on port 9042, which returns rows from its tables. Encryption is optional: traffic is only protected if TLS is enabled on the server and the client.

Transport
TCP
Exposure risk
7/10 high if reachable from the Internet
Encryption
Optional TLSTLS only if negotiated
IANA status
Unassignedcommon use differs from the registry
Range
Registered (1024-49151)
01 Security

Is port 9042 dangerous?

Common attacks and weaknesses

  • Default cassandra/cassandra superuser.

How to secure it

  • Enable authentication, change the default superuser, use client TLS.

Unofficial use. The IANA assignment below differs from what is usually found on this port in practice.

02 Registry

IANA registry entries for port 9042

No entry. The port is free for any application, so check what uses it on your hosts.

// source: IANA service name and port number registry

03 Check it

Which program uses port 9042, and is it reachable?

Linux

sudo ss -ltnup 'sport = :9042'      # process listening on 9042
sudo lsof -nP -i :9042

macOS

sudo lsof -nP -i :9042

Windows (PowerShell)

Get-NetTCPConnection -LocalPort 9042 -State Listen | Select LocalAddress, OwningProcess
Get-NetUDPEndpoint -LocalPort 9042
netstat -ano | findstr :9042

From another machine

nmap -p 9042 -sV <host>
nc -zv <host> 9042

Block it in the firewall

sudo ufw deny 9042/tcp                                         # Linux (ufw)
New-NetFirewallRule -DisplayName "Block 9042" -Direction Inbound -LocalPort 9042 -Protocol TCP -Action Block  # Windows
04 FAQ
What is port 9042 used for?

Apache Cassandra native protocol.

Is port 9042 TCP or UDP?

Port 9042 is registered for TCP.

Is it safe to open port 9042?

It is rated 7/10 (high) when exposed to the Internet. Default cassandra/cassandra superuser. Enable authentication, change the default superuser, use client TLS.

How do I check if port 9042 is open?

On Linux run "ss -ltnup 'sport = :9042'", on macOS "lsof -nP -i :9042", and on Windows "netstat -ano | findstr :9042" to see the local process. From another machine, "nmap -p 9042 <host>" shows whether it is reachable.

05 Related