NMAP Protocol Scanning and Enumeration
Nmap (Network Mapper) is a versatile tool for network discovery and security auditing. This cheat sheet focuses on protocol-specific scans, covering authentication and identity services, network protocols, and common vulnerabilities. Each section includes Nmap commands with explanations, use cases, and tips to maximise effectiveness. Use this guide for targeted reconnaissance, ensuring you have permission to scan the target network.
Authentication & Identity Services
These scans target protocols and services used for authentication and identity management, often revealing misconfigurations or weak credentials.
LDAP (Ports 389, 636)
Lightweight Directory Access Protocol (LDAP) is used for directory services, often in corporate environments (e.g., Active Directory).
nmap -p 389,636 --script=ldap* <target> # Runs all LDAP scripts (e.g., enumeration, search)
nmap --script "(ldap*) and not brute" -p 389 <target> # Runs LDAP scripts, excluding brute-force
nmap -p 636 --script=ldap-search,ldap-rootdse <target> # Queries LDAP directory and root DSE (secure port)Context: LDAP scans help identify directory structures, user accounts, or misconfigurations in Active Directory or other LDAP servers.
Tips:
Use
--script=ldap-rootdseto retrieve server metadata.Avoid brute-force scripts (
ldap-brute) unless explicitly permitted, as they can lock accounts.Combine with
-sVto confirm LDAP service versions.
Kerberos (Port 88)
Kerberos is a network authentication protocol used in Windows domains.
nmap -p 88 --script=krb5-enum-users --script-args="krb5-enum-users.realm='DOMAIN.LOCAL'" <target> # Enumerates valid Kerberos users
nmap -p 88 --script=krb5-info <target> # Gathers Kerberos server infoContext: These scripts identify valid usernames or server details in Kerberos realms, useful for domain enumeration.
Tips:
Specify the correct realm (e.g.,
DOMAIN.LOCAL) for accurate results.Use with caution, as enumeration may trigger security alerts.
SMB (Ports 139, 445)
Server Message Block (SMB) is used for file sharing and Windows services.
Context: SMB scans reveal shared folders, user accounts, and potential vulnerabilities like null sessions or outdated protocols.
Tips:
Combine with
-sVto detect SMB versions (e.g., SMBv1, SMBv2).Check for null sessions (
smb-null-session) to identify misconfigured servers.Be cautious with
smb-vuln*, as some scripts may disrupt services.
RDP (Port 3389)
Remote Desktop Protocol (RDP) enables remote access to Windows systems.
Context: RDP scans identify weak encryption or vulnerabilities that could allow unauthorised access.
Tips:
Use
rdp-vuln-ms12-020to check for older, vulnerable RDP implementations.Combine with
--script-argsto test specific credentials if permitted.
WinRM (Ports 5985, 5986)
Windows Remote Management (WinRM) is used for remote administration.
Context: WinRM scans help identify remote management configurations and potential user accounts.
Tips:
Use on Windows environments to uncover misconfigured remote access.
Combine with HTTP scripts if WinRM uses HTTP/HTTPS protocols.
Network Services
These scans target common network services, focusing on enumeration and vulnerability detection.
FTP (Port 21)
File Transfer Protocol (FTP) is used for file transfers.
Context: FTP scans identify anonymous access, server types, and exploitable backdoors.
Tips:
ftp-anonchecks for anonymous login (common misconfiguration).Use
ftp-bounceto test for outdated servers vulnerable to bounce attacks.
SSH (Port 22)
Secure Shell (SSH) is used for secure remote access.
Context: SSH scans reveal supported algorithms, host keys, and potential weak credentials.
Tips:
Avoid
ssh-bruteunless permitted, as it may lock accounts.Use
sshv1to detect outdated, insecure SSHv1 protocol.
Telnet (Port 23)
Telnet provides unencrypted remote access (rarely used today).
Context: Telnet scans identify legacy systems and authentication details.
Tips:
Telnet is inherently insecure; its presence may indicate a misconfiguration.
Use
telnet-ntlm-infofor Windows environments.
SMTP (Ports 25, 465, 587)
Simple Mail Transfer Protocol (SMTP) handles email delivery.
Context: SMTP scans identify misconfigured mail servers, open relays, or valid usernames.
Tips:
smtp-open-relaychecks for servers that allow unauthorised email relaying.Combine with
-sVto detect mail server software.
DNS (Port 53)
Domain Name System (DNS) resolves domain names to IPs.
Context: DNS scans reveal domain structures, recursion settings, or cached data.
Tips:
dns-zone-transfercan expose entire domain records if misconfigured.Use
-sUfor UDP-based DNS scans.
TFTP (Port 69)
Trivial File Transfer Protocol (TFTP) is used for simple file transfers.
Context: TFTP scans identify accessible files or misconfigured servers.
Tips:
Requires
-sU(UDP scan) as TFTP uses UDP.Look for configuration files or firmware in TFTP directories.
POP3 (Ports 110, 995)
Post Office Protocol (POP3) retrieves emails.
Context: POP3 scans identify server features and potential weak credentials.
Tips:
Use
pop3-brutecautiously to avoid account lockouts.Combine with
-sVto detect POP3 server versions.
IMAP (Ports 143, 993)
Internet Message Access Protocol (IMAP) manages email access.
Context: IMAP scans reveal server features and authentication weaknesses.
Tips:
Similar to POP3, avoid
imap-bruteunless permitted.Check for SSL/TLS support on port 993.
SNMP (Ports 161, 162)
Simple Network Management Protocol (SNMP) manages network devices.
Context: SNMP scans extract device details, often revealing sensitive configurations.
Tips:
Requires
-sU(UDP scan) for SNMP.Test default community strings (e.g.,
public, private) withsnmp-brute.
R-Services (Ports 512, 513, 514)
Remote services (rlogin, rsh, rexec) are legacy protocols for remote access.
Context: R-services are rare but indicate outdated, insecure systems if present.
Tips:
Combine with
-sVto confirm service versions.Presence of r-services often warrants deeper investigation.
IPMI (Port 623)
Intelligent Platform Management Interface (IPMI) manages server hardware.
Context: IPMI scans identify remote management interfaces and known vulnerabilities.
Tips:
ipmi-cipher-zero checks for weak encryption settings.Often found on server hardware (e.g., Dell iDRAC, HP iLO).
RSync (Port 873)
Rsync synchronises files between systems.
Context: Rsync scans reveal accessible file shares or modules.
Tips:
Check for anonymous access or exposed sensitive directories.
Combine with
-sVto identify rsync versions.
MSSQL (Ports 1433, 1434, 2433)
Microsoft SQL Server manages databases.
Context: MSSQL scans identify database instances, weak passwords, and configurations.
Tips:
ms-sql-empty-passwordchecks for default or blank credentials.Use cautiously to avoid locking out accounts.
Oracle TNS (Port 1521)
Oracle Transparent Network Substrate (TNS) manages Oracle database connections.
Context: Oracle scans reveal database instances and potential SIDs for further attacks.
Tips:
oracle-sid-bruteattempts to guess database SIDs; use with permission.Combine with
-sVto confirm Oracle versions.
NFS (Port 2049)
Network File System (NFS) shares files across networks.
Context: NFS scans identify shared directories and access controls.
Tips:
nfs-showmountreveals mountable shares; check for world-readable shares.Combine with
-sVto detect NFS versions.
MySQL (Port 3306)
MySQL is a popular open-source database.
Context: MySQL scans reveal database details and potential weak credentials.
Tips:
mysql-empty-passwordchecks for default or blank credentials.Avoid
mysql-bruteunless permitted.
PostgreSQL (Ports 5432, 5433)
PostgreSQL is an open-source relational database.
Context: PostgreSQL scans identify database configurations and credentials.
Tips:
Use
pgsql-infoto confirm SSL/TLS on port 5433.Avoid brute-forcing unless permitted.
NetBIOS (Ports 137, 138)
NetBIOS provides name resolution and session services in Windows networks.
Context: NetBIOS scans reveal Windows network information and shares.
Tips:
Combine with SMB scans for comprehensive Windows enumeration.
Requires
-sUfor UDP-based NetBIOS scans.
VNC (Port 5900)
Virtual Network Computing (VNC) enables remote desktop access.
Context: VNC scans identify remote desktop configurations and credentials.
Tips:
vnc-titlereveals VNC session names, useful for reconnaissance.Avoid
vnc-bruteunless permitted.
Redis (Port 6379)
Redis is an in-memory data store.
Context: Redis scans reveal server details and potential weak authentication.
Tips:
Check for unprotected Redis instances (common misconfiguration).
Avoid brute-forcing unless permitted.
Elasticsearch (Port 9200)
Elasticsearch is a search and analytics engine.
Context: Elasticsearch scans identify exposed search clusters and configurations.
Tips:
Check for unauthorised access or exposed APIs.
Combine with
-sVto detect Elasticsearch versions.
Memcached (Port 11211)
Memcached is a distributed memory caching system.
Context: Memcached scans reveal caching server details and potential exposures.
Tips:
Check for unauthenticated access, a common misconfiguration.
Requires
-sUfor UDP-based scans.
RPCBind (Port 111)
Remote Procedure Call (RPC) bind service maps RPC services.
Context: RPCBind scans identify available RPC services (e.g., NFS, NIS).
Tips:
Use both
-sUand-sTfor comprehensive RPC scanning.Combine with NFS or r-services scans.
SIP (Port 5060)
Session Initiation Protocol (SIP) manages VoIP communications.
Context: SIP scans reveal VoIP configurations and potential user accounts.
Tips:
Requires
-sUfor UDP-based SIP scans.Check for weak SIP credentials or exposed endpoints.
MQTT (Port 1883)
Message Queuing Telemetry Transport (MQTT) is used for IoT messaging.
Context: MQTT scans identify IoT messaging configurations.
Tips:
Check for unauthenticated access, common in IoT devices.
Combine with
-sVto detect MQTT broker versions.
RMI (Port 1099)
Remote Method Invocation (RMI) is used for Java remote objects.
Context: RMI scans target Java-based applications for misconfigurations.
Tips:
rmi-vuln-classloaderchecks for deserialization vulnerabilities.Combine with
-sVto identify Java versions.
NTP (Port 123)
Network Time Protocol (NTP) synchronises clocks.
Context: NTP scans reveal server details and potential DDoS vulnerabilities.
Tips:
ntp-monlistchecks for amplification attack vectors.Requires
-sUfor UDP-based scans.
Docker (Port 2375)
Docker manages containerised applications.
Context: Docker scans identify exposed container management APIs.
Tips:
Check for unauthenticated access, a critical misconfiguration.
Combine with
-sVto confirm Docker versions.
RabbitMQ (Port 5672)
RabbitMQ is a message broker for distributed systems.
Context: RabbitMQ scans reveal messaging configurations and potential exposures.
Tips:
Check for default credentials (e.g., guest/guest).
Combine with
-sVto detect RabbitMQ versions.
Jenkins (Port 8080)
Jenkins is a CI/CD automation server.
Context: Jenkins scans identify exposed CI/CD servers and potential vulnerabilities.
Tips:
Check for anonymous access or script console exposure.
Combine with
http-vuln*scripts for deeper vulnerability checks.
AJP (Port 8009)
Apache JServ Protocol (AJP) connects web servers to application servers.
Context: AJP scans check for misconfigurations, including Ghostcat (CVE-2020-1938).
Tips:
Look for file inclusion vulnerabilities with
ajp-auth.Combine with
-sVto detect Apache Tomcat versions.
Kubernetes API Server (Port 6443)
Kubernetes manages container orchestration.
Context: Kubernetes scans identify exposed APIs or misconfigured kubelets.
Tips:
Check for unauthorised access or exposed dashboards.
Combine with -sV to detect Kubernetes versions.
CouchDB (Port 5984)
CouchDB is a NoSQL database.
Context: CouchDB scans check for exposed databases and vulnerabilities (e.g., CVE-2017-12635). Tips:
Look for unauthenticated access or admin party mode.
Combine with -sV to detect CouchDB versions.
VMware (Ports 902, 903, 443)
VMware manages virtualisation platforms.
Context: VMware scans identify virtualisation environments and potential weaknesses.
Tips:
Check for outdated VMware versions with known vulnerabilities.
Combine with
-sVfor version detection.
TeamViewer (Port 5938)
TeamViewer enables remote desktop access.
Context: TeamViewer scans identify remote access configurations.
Tips:
Check for exposed instances or weak configurations.
Combine with
-sVto detect TeamViewer versions.
Bacula (Port 9101)
Bacula is a backup system.
Context: Bacula scans identify backup system configurations.
Tips:
Check for unauthenticated access or misconfigured backups.
Combine with
-sVto detect Bacula versions.
X11 (Port 6000)
X11 is a windowing system for graphical interfaces.
Context: X11 scans identify exposed graphical interfaces, often on Linux systems.
Tips:
Look for unauthenticated access, a critical misconfiguration.
Rarely used in modern systems but indicates legacy setups.
Web Services (Ports 80, 443, 8080, 8443)
Web services include HTTP/HTTPS servers and applications.
Context: Web scans identify server configurations, frameworks, and vulnerabilities.
Tips:
http-vuln*checks for CVEs and misconfigurations.Combine with
-sVto detect web server versions (e.g., Apache, Nginx).
WebDAV (Ports 80, 443, 8080)
WebDAV extends HTTP for collaborative file management.
Context: WebDAV scans reveal file-sharing extensions on web servers.
Tips:
Check for unauthorised access or write permissions.
Combine with HTTP scripts for comprehensive web enumeration.
Apache Hadoop (Port 50070)
Hadoop is a big data processing framework.
Context: Hadoop scans identify exposed big data clusters.
Tips:
Check for unauthenticated access to NameNode or DataNode.
Combine with
-sVto detect Hadoop versions.
Tomcat (Ports 8080, 8443)
Apache Tomcat is a Java-based web server.
Context: Tomcat scans check for manager access and user enumeration.
Tips:
Look for default credentials (e.g., admin/admin) in
http-tomcat-manager.Combine with
http-vuln*for CVE checks.
Zookeeper (Port 2181)
ZooKeeper coordinates distributed systems.
Context: ZooKeeper scans reveal coordination service details.
Tips:
Check for unauthenticated access, common in misconfigured clusters.
Combine with
-sVto detect ZooKeeper versions.
Kafka (Port 9092)
Kafka is a distributed streaming platform.
Context: Kafka scans identify streaming platform configurations.
Tips:
Check for exposed brokers or unauthenticated access.
Combine with
-sVto detect Kafka versions.
Varnish (Port 6081)
Varnish is a caching proxy.
Context: Varnish scans identify caching proxy configurations.
Tips:
Check for misconfigured caching rules or exposed backends.
Combine with
-sVto detect Varnish versions.
Other Useful Nmap Scripts
Additional scripts for automation, brute-forcing, and vulnerability detection.
Common Automation & Miscellaneous Scripts
Context: These commands provide quick, automated scans for broad reconnaissance.
Tips:
Use
-T4for faster scans on reliable networks.Combine
-sCand-sVfor comprehensive initial scans.
Brute Force
Context: Brute-force scripts test credentials across various protocols.
Tips:
Use with caution and explicit permission to avoid account lockouts.
Specify
--script-args userdb=<file>,passdb=<file>for custom credential lists.
Vulnerability Detection
Context: Vulnerability scripts identify known CVEs and misconfigurations.
Tips:
Combine with
-sVfor accurate vulnerability detection.Use
--scriptvuln for a broad vulnerability sweep.
Web Technologies & Frameworks
Context: These scripts identify web server frameworks (e.g., WordPress, Drupal) and configurations. Tips:
http-wordpress-enumandhttp-drupal-enumare useful for CMS enumeration.Combine with
http-vuln*to check for framework-specific vulnerabilities.
Best Practices
Obtain Permission: Always ensure you have explicit authorisation before scanning.
Start with Safe Scans: Use
-sC,-sV, orsafescripts for initial reconnaissance.Optimise for Stealth: Use
-sS, -T2, or-fto reduce detectability.Combine Scans: Pair
-sVwith protocol-specific scripts for accurate results.Avoid Intrusive Scripts: Use brute-force or vulnerability scripts only with permission.
Save Output: Use -oA <prefix> to store results in multiple formats for analysis.
Analyse Results: Filter outputs (e.g.,
grep open) and prioritise open ports/services for further testing.
Output Analysis Tips
Open Ports: Focus on services like HTTP, SMB, or RDP for deeper enumeration.
Filtered Ports: Indicate firewalls; use evasion techniques (
-f, -D) to probe further.Service Versions: Use -sV to identify software versions for vulnerability research.
Use
--reason: Understand why ports are open, closed, or filtered.Parse Outputs: Use tools like
grep, xsltproc, ornmaptocsvto analyse-oGor-oXoutputs.
Last updated