Attacking a service means knowing what it is, what it does, and what the designer never expected. Before a single payload, identify the service, confirm its version, and map its features — exploitable surface usually hides in features, not CVEs.

The Universal Workflow

Discover port  →  Identify service + version  →  Enumerate anonymous/default auth
             →   Enumerate with any creds you have
             →   Attack (brute force / exploit / abuse feature)
             →   Post-exploit (loot, pivot)

Skip a step, waste hours.

Port Discovery

# Fast TCP sweep (top 1000)
nmap -T4 -Pn <IP>
 
# Full TCP, service + default scripts
sudo nmap -p- -sS -sV -sC -T4 -oN tcp.nmap <IP>
 
# UDP — top 100 (slower; UDP services matter: DNS, SNMP, NTP, TFTP, NBNS)
sudo nmap -sU --top-ports 100 -T4 -oN udp.nmap <IP>
 
# Rustscan (faster port discovery, feeds into nmap)
rustscan -a <IP> --ulimit 5000 -- -sV -sC

Rules of thumb:

  • Always -p- for full TCP against a lab target. Real pentests often time-box this.
  • Never trust -sn ping sweeps on segmented networks — ICMP is commonly blocked.
  • -Pn disables ping; use it when hosts don’t respond to pings but have open ports.

Service Identification

-sV is the default version probe; -sC runs the “default” NSE scripts (safe reconnaissance).

nmap -p<port> -sV -sC --version-all <IP>

For unusual ports, dig into NSE by category:

nmap --script-help default
nmap --script "ftp-* and not brute" <IP>
nmap --script "smb-vuln-*" -p445 <IP>
nmap --script "smtp-enum-users" --script-args smtp-enum-users.methods={VRFY,EXPN,RCPT} -p25 <IP>

When NSE isn’t enough — talk to the service directly.

# Netcat
nc -nv <IP> <port>
# Common greetings:
# FTP:  220 (vsFTPd 3.0.3)
# SSH:  SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
# SMTP: 220 mail.target.com ESMTP Postfix (Debian)
# POP3: +OK Dovecot ready.
# IMAP: * OK [CAPABILITY IMAP4rev1 LITERAL+ ...] mail server ready
 
# Curl for anything HTTP-ish
curl -sI http://<IP>:<port>
 
# OpenSSL for TLS-wrapped services
openssl s_client -connect <IP>:443 -servername <IP>
openssl s_client -connect <IP>:993 -starttls imap
openssl s_client -connect <IP>:587 -starttls smtp

The “Who Are You?” Service Fingerprint Rig

# nmap scripts to run for any new host (adjust ports)
sudo nmap -p- -sV -sC -O --osscan-guess -oN all.nmap <IP>
nmap -p21,80,443,445,3389 -sV --script "default,discovery,vuln" <IP>
 
# SNMPwalk (UDP 161 — don't miss it)
snmpwalk -v2c -c public <IP>
onesixtyone -c /usr/share/seclists/Discovery/SNMP/common-snmp-community-strings.txt <IP>
 
# NetBIOS / NBNS
nbtscan <IP>
nmblookup -A <IP>

Checking for Vulnerabilities (Non-Destructive)

# Vulners (if NSE vulners is installed)
nmap --script vulners <IP>
 
# searchsploit on the version you found
searchsploit vsftpd 2.3.4
searchsploit "MS SQL Server 2019"
 
# Metasploit auxiliary check modules (SAFE)
msf6 > use auxiliary/scanner/smb/smb_ms17_010
msf6 > use auxiliary/scanner/http/wordpress_scanner

Common Default Credentials to Always Try

ServiceAccountPassword
FTPanonymousanonymous / blank
SSH / Linuxrootroot / toor / <distro>
SMBguestblank
MSSQLsablank / sa / Password1
MySQLrootblank / root / mysql
Tomcattomcat / admintomcat / s3cret / changeit
phpMyAdminrootblank
Oraclesystem / sys / scottmanager / change_on_install / tiger
VNC(no username)blank
SNMP(community)public / private
RDPAdministratorAdministrator / Password1

Service Enumeration Priority

Order services from highest payoff to lowest when triaging a scan result:

  1. SMB/445 — share hunting, user enum, RCE if local-admin. Almost always worth 30 min.
  2. MSSQL/1433, MySQL/3306, PostgreSQL/5432 — any blank/default = immediate shell.
  3. FTP/21 — anonymous often leaks configs, backups, source code.
  4. RDP/3389 — brute force, BlueKeep, session hijack.
  5. SMTP/25 — user enumeration feeds spraying across other services.
  6. DNS/53 — zone transfer leaks internal hostnames; feeds everything.
  7. SNMP/161 — misconfigured public community = full MIB walk = creds / topology.
  8. IMAP/POP3 — low value unless the org actually uses them for primary mail.

Prioritize by what each service gives you if it falls, not alphabetical order.

Note-Taking During Service Attacks

Per-host notes should capture, at minimum:

  • Open ports + version banners
  • Default/anonymous auth results (yes/no + output)
  • Any usernames extracted
  • Any hashes/creds obtained + source (which service, which method)
  • Commands you ran that worked (reproducibility for the report)

This feeds Password Attacks spraying and the final report.