Skip to content
Buy me a coffee

Common ports

tag: networkingtag: reference

What it’s for: Secure Shell, an encrypted remote command line. Used to manage Linux servers and network devices.

How malware uses it:

  • Botnets scan the internet for SSH and guess weak or default passwords.
  • Attackers who steal SSH keys or passwords use them to move between servers.
  • SSH tunnels can carry other traffic out of a network, hidden inside the encryption.

What to look for: Many failed logins from one source, SSH from workstations that don’t normally use it, and outbound SSH to unfamiliar internet addresses.

What it’s for: An old remote command line that sends everything, passwords included, in cleartext. SSH replaced it.

How malware uses it: IoT botnets such as Mirai spread by logging in to cameras and routers over Telnet with default usernames and passwords.

What to look for: Anything listening on 23 at all. On a modern network it’s usually a forgotten device or something that shouldn’t be there.

What it’s for: Mail sent between mail servers.

How malware uses it:

  • Spam bots send mail straight from infected computers.
  • Some info-stealers send what they collect to an attacker’s mailbox over SMTP.

What to look for: Workstations talking to the internet on port 25. Normal mail goes through your mail server, not directly from a laptop.

What it’s for: Turning names into addresses. See DNS.

How malware uses it:

  • Looking up its command-and-control (C2) server by name, so the address can change without changing the malware.
  • Some families generate many random-looking domains a day and try each until one answers.
  • DNS tunnelling hides data inside lookups, for example in long subdomains.

What to look for: Long or random-looking subdomains, lots of lookups for domains that don’t exist, unusual record types such as TXT in bulk, and computers using an outside DNS server instead of your own.

What it’s for: Handing out IP addresses, the gateway and the DNS server when a device joins a network.

How attackers use it: A rogue DHCP server can hand out its own gateway or DNS server, so traffic flows through the attacker’s machine.

What to look for: DHCP answers from any device that isn’t your real DHCP server.

What it’s for: Unencrypted web traffic.

How malware uses it:

  • Downloading the next stage of an infection.
  • Checking in with C2 on a regular timer, called beaconing, to blend in with web browsing.

What to look for: Downloads of executables or scripts, odd or missing user agents, requests straight to an IP address instead of a name, and check-ins at very regular intervals. Because HTTP is cleartext, a packet capture shows the full request.

What it’s for: Encrypted web traffic. Most of the web uses it.

How malware uses it:

  • C2 over HTTPS hides inside normal-looking encrypted traffic.
  • Some malware sends its own non-HTTPS protocol on 443, because firewalls usually allow it.

What to look for: Self-signed or newly issued certificates, connections to newly registered domains, regular beaconing, and traffic on 443 that isn’t TLS at all.

What it’s for: Windows file and printer sharing.

How malware uses it:

  • WannaCry and NotPetya spread worm-style over SMB using the EternalBlue exploit.
  • Attackers use admin shares and tools such as PsExec to move from one machine to the next.

What to look for: Workstations talking to other workstations on 445, and 445 open to the internet (it never should be).

What it’s for: Remote Desktop, a full graphical session on a Windows machine. See How to RDP into a Windows Machine.

How attackers use it:

  • RDP open to the internet, with weak or reused passwords, is one of the most common ways ransomware groups get in.
  • Once inside, they use RDP to move to other machines.

What to look for: Bursts of failed logons (Windows event 4625), successful remote logons (event 4624 with logon type 10) from unexpected sources or at odd hours, and 3389 open to the internet.

DNS: how a name becomes an address.

One Reverse Look

"A little learning is a dangerous thing." ~ A. Pope

One Reverse Look · Made with ❤ · Your friendly knowledge seeker