Sem 7

Service Enumeration

Actively querying services to extract structured information: FTP, SMB, NetBIOS, SNMP and DNS enumeration with smbclient, enum4linux, smbmap, snmpwalk, snmp-check, dig and zone transfers, plus the full set of Nmap NSE scripts. Covers deck 4 and the NSE command reference.

Port scanning answers "what ports are open?". Enumeration goes further: "what services and versions are running, and how can they be exploited?" It is the process of actively querying services on open ports to gather structured information after scanning and discovery. You move from knowing the doors and windows exist to peeking inside.

What to enumerateSearch on YouTube

ServicePort(s)What to look for
NetBIOS137/138 (UDP), 139 (TCP)Computer names, workgroup/domain, logged-in users, shared resources
FTP21Anonymous login, file access
SSH22Banner grabbing, weak configurations
Telnet23Plaintext credentials
SMTP25, 587VRFY/EXPN users, mail relay
DNS53Zone transfers, subdomain enumeration
HTTP/HTTPS80 / 443Banners, web enumeration, vhosts
SMB139 / 445Shares, null sessions, users
SNMP161 (UDP)Community strings, system info
LDAP389 / 636Directory info
RDP3389Banner and security level
DatabasesMySQL 3306, PostgreSQL 5432, MSSQL 1433, Oracle 1521Weak credentials, schema info

FTP enumeration (port 21)Search on YouTube

FTP (File Transfer Protocol) transfers files between computers over TCP/IP. It uses two channels — a command/control channel and a data channel — in a client-server model. Its drawback: data, including credentials, is sent in clear text. The secure variant is SFTP (Secure FTP, port 22), which authenticates both user and server; both FTP and SFTP use TCP.

nmap -p 21 --script ftp-anon <TARGET_IP>          # anonymous login allowed?
nmap -p 21 --script ftp-syst <TARGET_IP>          # system info
nmap -p 21 --script ftp-bounce <TARGET_IP>        # FTP bounce attack
nmap -p 21 --script ftp-brute <TARGET_IP>         # brute-force FTP creds
nmap -p 21 --script ftp-vsftpd-backdoor <TARGET_IP>  # vsftpd 2.3.4 backdoor
nmap -p 21 --script ftp-proftpd-backdoor <TARGET_IP>
nmap -p 21 --script "ftp-*" 192.168.10.149        # all ftp scripts (noisy/slow)

The most important script is ftp-anon (checks anonymous login). Some scripts (like the backdoor checks) not only detect but also exploit, so exploit results appear.

searchsploitSearch on YouTube

searchsploit vsftpd           # search the local Exploit-DB copy by keyword
searchsploit -p <exploit>     # show the full path/details of an exploit
searchsploit -m <exploit>     # mirror (copy) an exploit to the current dir

searchsploit searches the local copy of the Exploit-DB repository for exploits related to a keyword. For example, vsftpd 2.3.4 has a famous backdoor in its code.

SMB enumeration (ports 139/445)Search on YouTube

SMB (Server Message Block) is a client-server, request-response protocol for sharing files, printers and other resources on a network. Clients connect over TCP/IP. Windows has included SMB since Windows 95; Samba is the open-source SMB server for Unix.

A share is a folder, printer or resource made available over SMB. Examples: C$ (admin share of C:), ADMIN$ (system root), IPC$ (inter-process communication, no files, used for remote management), print$ (printer drivers), plus custom shares. Shares matter because misconfigured ones may allow unauthenticated (guest/anonymous) access, and some contain config files, password lists or backups.

ToolBest forKey capability
smbclientManual interactionFTP-like client to connect and browse shares
enum4linuxBroad enumerationAutomates RPC/NetBIOS/SMB gathering in one go
nmap --script smb-*Fast scanningEnumerates specific data quickly
crackmapexecCredential testing, post-exploitationValidates creds, runs commands, dumps hashes
smbmapShare enumerationLists accessible shares and permissions

enum4linux and smbclientSearch on YouTube

nmap -p 139,445 <TARGET_IP>              # check SMB port status
enum4linux -a 192.168.56.106            # full enum: OS, NetBIOS, users, shares, policy
enum4linux -n <TARGET_IP>               # NetBIOS name info

sudo apt install smbclient
smbclient -L //192.168.56.110 -N        # list shares, -N = no password (anonymous)
smbclient //192.168.56.110/tmp -N       # connect to a share (interactive shell)

enum4linux -a extracts OS info, NetBIOS name, users, share listings and the password policy in one command. Inside an smbclient session:

CommandPurpose
lsList files in the share
cd <folder>Change directory
get <file>Download a file
put <file>Upload a file
exitQuit the session

Listing flags: D directory, R read-only, H hidden, S system, A archive, N normal.

The workflow: SMB detected → enumerate shares → identify accessible shares → investigate them for useful information. Anonymous SMB access may help you gain a shell.

SMB NSE scripts and smbmapSearch on YouTube

nmap --script smb-os-discovery <TARGET_IP>         # OS / SMB version
nmap --script smb-enum-shares <TARGET_IP>          # list shares + our access
nmap -p 445 --script smb-enum-users <TARGET_IP>    # enumerate user accounts
nmap --script smb-vuln-ms17-010 <TARGET_IP>        # EternalBlue
nmap --script smb-vuln-ms08-067 <TARGET_IP>        # MS08-067 Windows RCE
  • smb-enum-shares lists active shares and whether you have permission to access them.
  • smb-enum-users enumerates local/domain users via the SMB service on port 445, using anonymous/null sessions where possible; valid usernames feed brute-force, privilege escalation or social engineering.
  • smb-vuln-ms17-010 checks EternalBlue (MS17-010): unauthenticated remote code execution over SMB, used by WannaCry and NotPetya (2017) on unpatched SMBv1. A comparable Samba RCE is CVE-2017-7494.
  • smbmap is a Python CLI to enumerate shares and test read/write permissions.

A classic question gives a scan showing 139/tcp open netbios-ssn and 445/tcp open microsoft-ds. These ports matter because SMB often allows null-session enumeration and may be vulnerable to EternalBlue. Confirm vulnerability with nmap --script smb-vuln-ms17-010, and enumerate with smbclient -L //IP -N, enum4linux -a IP, and the smb-enum-* scripts.

NetBIOS enumeration (ports 137/138 UDP, 139 TCP)Search on YouTube

NetBIOS (Network Basic Input/Output System) is an older Windows networking protocol. It provides a name service (137, maps NetBIOS names to IPs), datagram service (138, connectionless) and session service (139, connection-oriented for file/printer sharing). NetBIOS enumeration extracts the computer's NetBIOS name, usernames and groups, domain/workgroup names, and network-resource details.

nbtstat -A <TARGET_IP>              # Windows: -A = by IP, -a = by name
nbtscan <TARGET_IP>                 # Linux
nbtscan 192.168.1.0/24
enum4linux -n <TARGET_IP>           # NetBIOS name info
nmap --script nbstat.nse -p 137 <TARGET_IP>   # NetBIOS name table via NBNS (UDP/137)

SNMP enumeration (UDP 161 queries, 162 traps)Search on YouTube

SNMP (Simple Network Management Protocol) monitors and manages network devices (routers, switches, servers, printers). It runs over UDP port 161 (queries) and 162 (traps/alerts). Components:

  • SNMP Manager — the central monitoring server that sends queries.
  • SNMP Agent — runs on the managed device, stores data in a MIB, answers queries and sends alerts.
  • MIB (Management Information Base) — a hierarchical tree of objects, each identified by an OID (Object Identifier), a dotted number string. Example: 1.3.6.1.2.1.1.5.0 = system name.
ObjectOIDDescription
sysDescr.01.3.6.1.2.1.1.1.0System description (OS, version)
sysObjectID.01.3.6.1.2.1.1.2.0Vendor ID of the device
sysUpTime.01.3.6.1.2.1.1.3.0Time since last reboot
sysContact.01.3.6.1.2.1.1.4.0Contact person
sysName.01.3.6.1.2.1.1.5.0Hostname
sysLocation.01.3.6.1.2.1.1.6.0Physical location

SNMP versions and community stringsSearch on YouTube

VersionSecurity
SNMPv1 (1988)Community strings in plaintext; Read-Only (RO) or Read-Write (RW). No encryption or real authentication.
SNMPv2c (1993)Adds bulk retrieval (GETBULK) and better errors; still plaintext community strings ("c" = community-based).
SNMPv3 (1998)Security-focused: User-Based Security Model (USM) with authentication (MD5/SHA), encryption/privacy (DES, AES) and access control (VACM). Community strings deprecated.

The community string is like a password — a shared secret between manager and agent. Defaults are widely known and dangerous: public = read-only, private = read-write. If a device accepts the string, it returns the requested information.

snmpwalk -v2c -c public <TARGET_IP>   # walk the whole MIB tree (v2c, string "public")
snmp-check <TARGET_IP> -c public       # same data, more human-readable

snmpwalk traverses the OIDs and returns their values. A community wordlist (community.txt) might hold: public, private, manager, admin, test, guest.

Information gathered: system info (hostname, description, OS, uptime), network info (IPs, routing tables, ARP cache), user accounts and groups, running processes, installed software, open TCP/UDP ports, and device configuration (router ACLs, firewall rules). If a read-write string is found, the attacker could change configurations remotely.

SNMP countermeasures: disable SNMP if unused, change the default community strings, restrict access by ACL, and move to SNMPv3 (authentication + encryption). Keep enumeration non-destructive by using only GET/WALK (reads), never snmpset.

DNS enumeration (port 53)Search on YouTube

DNS translates domain names to IP addresses on port 53 and stores metadata: mail servers, subdomains, aliases. An application calls the resolver library, which queries name servers. Resolution is iterative or recursive (easier for the client). The authoritative name server holds a zone file of DNS records (A, AAAA, CNAME, MX, etc.).

DNS enumeration gathers DNS records to map a domain's infrastructure: subdomains and hostnames, internal domains, mail servers, name servers and zone transfers. Techniques and tools: whois, nslookup/dig, zone transfer (AXFR), dnsenum, fierce, dnsrecon, theHarvester, sublist3r.

dig record queriesSearch on YouTube

dig A example.com              # IPv4 address
dig AAAA example.com           # IPv6 address
dig NS example.com             # name servers
dig MX example.com             # mail servers
dig TXT example.com            # TXT records (SPF, DKIM, verification)
dig SOA example.com            # start of authority / admin
dig CNAME www.example.com      # alias
dig ANY example.com            # any records
dig -x 142.250.66.14           # reverse lookup
dig +trace example.com         # full resolution path from the root
dig +short A example.com       # short answer (IP only)
dig @8.8.8.8 A example.com     # query a specific resolver
dig +dnssec example.com        # DNSSEC records

DNS zone transfer (AXFR)Search on YouTube

A zone transfer replicates the DNS database between servers — a primary (master) transfers its records to a secondary (slave) to keep backups in sync. Full transfer is AXFR; incremental (updated records only) is IXFR. Its purpose is legitimate, but if a server is misconfigured and unrestricted, anyone can request a transfer and receive a full list of hostnames, subdomains and IP mappings — a blueprint of the network.

# via host
host -t ns zonetransfer.me                    # find the name servers
host -l <domain> <nameserver>                 # attempt a zone transfer

# via dig
dig zonetransfer.me -t ns                     # find the name servers
dig axfr zonetransfer.me @<nameserver>        # request the zone transfer
dig AXFR zonetransfer.me @nsztm1.digi.ninja   # worked example

If the domain is correctly configured, the attempt fails. A normal DNS query asks for one record; a zone transfer asks for the entire "phonebook".

Prevent unauthorized zone transfers: restrict AXFR so only authorized secondary name servers can request it — configure allow-transfer with an explicit IP allow-list and/or TSIG key authentication, so requests from any other host are refused.

HTTP enumeration via NSESearch on YouTube

nmap --script http-apache-server-status <TARGET_IP>
nmap --script http-methods <TARGET_IP>        # allowed HTTP methods
nmap --script http-errors <TARGET_IP>
nmap --script http-grep <TARGET_IP>           # find IPs/emails in responses

http-grep works like Linux grep but searches the body of HTTP responses, finding IP addresses and email IDs by default.

The Service Enumeration lab (Day 4) and the Kenobi TryHackMe room practise this chain against Metasploitable: enumerate FTP (ftp-anon) and the vsftpd/ProFTPD versions, enumerate SMB shares with smbclient -L and enum4linux, mount an accessible share, and move on to the identified vulnerable service. Kenobi specifically chains an FTP version (ProFTPD) and an NFS/SMB share to gain access.

Quick self-testSearch on YouTube

What is the difference between scanning and enumeration?

Scanning finds which ports are open. Enumeration actively queries those services to extract structured information — versions, shares, users, config — and how they might be exploited.

Which single command lists SMB shares anonymously, and what does each flag mean?

smbclient -L //<IP> -N. -L lists shares, -N uses a null/anonymous session (no password).

What does enum4linux -a gather?

OS info, NetBIOS name, user list, share listings and the password policy — a full SMB enumeration in one command.

What is EternalBlue, and which Nmap script checks for it?

MS17-010, an unauthenticated remote code execution flaw over SMBv1 (used by WannaCry and NotPetya). Check with nmap --script smb-vuln-ms17-010.

On which port and transport does SNMP run, and what is a community string?

UDP 161 for queries (162 for traps). The community string is SNMP's password/shared secret; defaults are public (read-only) and private (read-write).

How do you non-destructively enumerate a device whose SNMP accepts "public"?

Read-only only: snmpwalk -v2c -c public <IP> to walk the MIB, or snmp-check <IP> -c public for readable output. Never use snmpset.

What is a MIB and an OID?

A MIB (Management Information Base) is the hierarchical tree of manageable objects on an SNMP device. Each object has a unique OID (Object Identifier), a dotted number string, e.g. sysName.0 = 1.3.6.1.2.1.1.5.0.

What is a DNS zone transfer and why is an open one dangerous?

AXFR replicates the full zone file from a primary to a secondary name server. If unrestricted, anyone can request it and receive every subdomain, host-to-IP mapping and mail server — a full blueprint of the network.

Give the dig command to attempt a zone transfer of zonetransfer.me from nsztm1.digi.ninja.

dig AXFR zonetransfer.me @nsztm1.digi.ninja.

Why is vsftpd 2.3.4 notable, and how do you find exploits for it offline?

It contains a well-known backdoor in its code. Search the local Exploit-DB copy with searchsploit vsftpd.

  • Enumeration actively queries open services for versions, shares, users and misconfigurations.
  • FTP (21) is cleartext; check ftp-anon, use searchsploit for versions like the vsftpd 2.3.4 backdoor.
  • SMB (139/445): enumerate with smbclient -L //IP -N, enum4linux -a, smbmap and smb-enum-* scripts; check EternalBlue with smb-vuln-ms17-010.
  • NetBIOS (137/138/139): nbtstat, nbtscan, nmap --script nbstat.nse -p 137.
  • SNMP (UDP 161) uses community strings (public/private); walk the MIB with snmpwalk -v2c -c public or snmp-check; v3 adds authentication and encryption.
  • DNS (53): query records with dig; attempt zone transfers with dig AXFR <domain> @<ns>. Restrict AXFR with allow-transfer to defend.