CyberHunter
Local dataset, no network
// Remote access

Port 22: SSH

Encrypted remote shell, file transfer (SFTP, SCP) and port forwarding. Constantly scanned and brute-forced on the Internet.

Secure ShellSFTPSCP
22

How SSH works

Remote access
terminal:22$ ls -la terminal:22$ ls -la

The client opens a session to port 22: each command typed is sent to the server, which runs it and returns the output. Everything is encrypted: someone on the path only sees unreadable bytes.

Transport
TCP · UDP · SCTP
Exposure risk
5/10 moderate if reachable from the Internet
Encryption
EncryptedTLS or built-in crypto
IANA status
Assigned1 registered service
Range
Well-known (0-1023)
01 Security

Is port 22 dangerous?

Common attacks and weaknesses

  • Password brute force and credential stuffing from botnets, around the clock.
  • Weak or reused keys, and authorized_keys planted by attackers for persistence.
  • Vulnerable daemons (for example regreSSHion, CVE-2024-6387 in OpenSSH).

How to secure it

  • Disable password login and root login; use keys or certificates.
  • Rate-limit with fail2ban, or restrict access by IP or behind a VPN.
  • Keep OpenSSH patched and audit authorized_keys files.
02 Registry

IANA registry entries for port 22

ServicePortTransportDescriptionReferenceUpdated
ssh 22 TCP, UDP, SCTP The Secure Shell (SSH) Protocol RFC 4251 -

// source: IANA service name and port number registry

03 Check it

Which program uses port 22, and is it reachable?

Linux

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

macOS

sudo lsof -nP -i :22

Windows (PowerShell)

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

From another machine

nmap -p 22 -sV <host>
sudo nmap -sU -p 22 <host>
nc -zv <host> 22

Block it in the firewall

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

Encrypted remote shell, file transfer (SFTP, SCP) and port forwarding. Constantly scanned and brute-forced on the Internet.

Is port 22 TCP or UDP?

Port 22 is registered for TCP and UDP and SCTP. In practice the service mostly uses TCP.

Is it safe to open port 22?

It is rated 5/10 (moderate) when exposed to the Internet. Password brute force and credential stuffing from botnets, around the clock. Disable password login and root login; use keys or certificates.

How do I check if port 22 is open?

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

05 Related

Latest vulnerability news

All news