Skip to content
Tutorials Center
My learning

Topics

Lesson 12 of 53 ยท Reconnaissance and Scanning

Service Enumeration: SMB, SNMP, LDAP, SMTP and DNS

Learn how authorized testers enumerate network services such as SMB, SNMP, LDAP, SMTP and DNS, what each leaks when misconfigured, and how defenders close the gaps.

A port scan tells you that port 445 is open. Enumeration asks the next question: what will this service tell a visitor who asks politely? Many network services were designed for trusted internal networks, and out of the box they answer questions that reveal user names, shares, hostnames, mail addresses and device details. Each answer shrinks the attacker's guessing work and, for a defender, shows exactly what needs closing.

Enumeration sends real requests to real services and some of them (zone transfers, directory queries, bulk lookups) generate noise or load. Do it only against systems named in your written scope, inside your own lab when learning. The commands in this lesson are descriptive; the runnable examples are stand-ins that never touch a network.

The idea: ask, then ask better

Enumeration is active recon, one step past passive recon. It is more intrusive because it talks to the target, so it belongs after authorization and scoping. The output feeds vulnerability scanning and later phases: user names guide authentication testing, and version strings guide patch checks.

Services that talk too much

SMB Shares, users, OS details.
SNMP Device info via community strings.
LDAP Directory of people and groups.

Built for trusted networks.

1 / 2

SMB and NetBIOS

SMB (Server Message Block) is the file and printer sharing protocol of Windows networks, usually on TCP 445 (older NetBIOS sessions used 139, with name service on UDP 137). Historically an anonymous null session, a connection with an empty user name and password, could list shares, user accounts and password policy. Modern Windows restricts this by default, but legacy systems, misconfigured file servers and some network storage devices still allow it. Testers look for: which shares exist, which are readable without credentials, what operating system and domain name the host reports, and whether SMB signing is required (see Active Directory network attacks).

Defenses: disable anonymous enumeration, block 445 and 139 at network edges, require SMB signing, disable the obsolete SMBv1 and remove the shares nobody needs.

SNMP

SNMP (Simple Network Management Protocol, UDP 161) lets monitoring tools read counters and settings from routers, switches, printers and servers. In versions 1 and 2c, access is guarded only by a community string, a shared word sent in cleartext, and the defaults public (read) and private (write) are famous. A device with a guessable community string can reveal its interface list, routing table, running software and sometimes user names. A writable string can allow configuration changes.

Defenses: use SNMPv3 with authentication and encryption, replace default strings, restrict which management hosts may query the device, and disable SNMP where it is not used.

LDAP

LDAP (TCP 389, or 636 with TLS) is the directory protocol behind Active Directory and many other identity systems. A directory holds users, groups, email addresses, phone numbers and organizational units. If a server permits an anonymous bind, a client can search it without credentials; even with a normal low-privilege account, an overly open directory shows an attacker who the administrators are and how the company is organized. Defenders disable anonymous binds, require TLS, limit which attributes ordinary users can read and alert on bulk queries.

SMTP

Mail servers (TCP 25 between servers, 587 for submission) may support the VRFY command (is this mailbox valid?) and EXPN (list this mailing list). Even without them, the difference between "accepted recipient" and "unknown user" reveals which addresses exist, called user enumeration. A list of valid mailboxes sharpens phishing and password spraying. Defenders disable VRFY and EXPN, return uniform responses where possible and rate-limit recipient probing.

DNS

DNS holds the map of an organization: hostnames, mail servers, test systems. The classic leak is a zone transfer (AXFR), meant for replicating a zone to a secondary server. If the primary server allows anyone to request it, one query returns every record in the zone. Other lookups (brute-forcing common subdomain names, reverse lookups across an address range) build the same map more slowly. Defenders restrict transfers to named secondary servers, avoid putting internal hostnames in public zones and review what their public DNS reveals.

Other services appear in the same pattern: NTP monitoring queries that expose client lists, RPC endpoint mappers that list services, NFS exports offered to everyone, and databases listening without authentication.

Typical commands (read-only)

These are examples of what testers run in a lab or with permission. They are descriptive, not part of the exercises.

TEXT
smbclient -L //192.0.2.50 -N          # list shares with no password
snmpwalk -v2c -c public 192.0.2.60    # read device info with a default string
ldapsearch -x -H ldap://192.0.2.70 -b "" -s base   # anonymous base query
dig AXFR example.test @ns1.example.test  # ask for a full zone transfer

Notice what each one does: it asks a normal protocol question. There is no exploit. That is exactly why misconfiguration is so common and so damaging.

A simulated enumerator

The stand-in below models a lab network as plain data: services with settings. A tiny enumerator reports what an unauthenticated visitor could learn from each one, and a second function says how to fix it. Nothing here opens a socket.

Node.js Enumerate an in-memory lab network

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

In a real engagement the data comes from tools and the findings go into the report; here the point is the mapping from service to leak to fix.

Spotting enumeration as a defender

Enumeration has a shape in the logs: many sequential failed lookups, one source asking for lists, repeated RCPT TO attempts with different names, bulk LDAP searches, or an AXFR request from an address that is not a secondary server. The second stand-in counts "unknown user" mail responses per source to flag user enumeration.

Node.js Flag mailbox enumeration in SMTP logs

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The same counting idea (many failures from one source) applies to every service above. Feed it into your logging and SIEM pipeline.

Enumeration tools and scripts at a glance

Each service has familiar helpers. Use them only against systems in scope.

  • DNS: Nmap scripts such as dns-brute (guess subdomains), dns-cache-snoop (test whether a resolver cached names) and dns-check-zone (check zone configuration). Defend by separating internal and external zones, disabling zone transfers to strangers and restricting recursion.
  • SMB: nmblookup and nbtscan query NetBIOS names, smbmap lists shares and permissions, enum4linux gathers users, groups and shares, and Nmap scripts like smb-enum-shares and the smb-vuln scripts check for known flaws. Metasploit has an auxiliary module for share enumeration. Defend by requiring SMB signing, disabling SMBv1 and null sessions, and limiting which hosts can reach port 445.
  • SNMP: snmpget reads one object by OID, snmpwalk walks a subtree, snmpbulkwalk uses GET-BULK for speed (GETNEXT steps through the tree one object at a time), and Nmap snmp scripts list information. The reply depends on the community string, so default strings such as "public" leak a lot. Defend by using SNMPv3 with authentication and encryption, changing community strings, allowing only management hosts and hardening system-level access with read-only views.
  • LDAP: ldapsearch queries a directory with a base DN and filter; enum4linux, windapsearch and the GUI browser JXplorer present users, groups and computers; the Nmap ldap-search script runs queries. Defend by disabling anonymous binds, requiring LDAPS or signing, and giving ordinary accounts only the read rights they need.
  • SMTP: the VRFY, EXPN and RCPT TO commands can confirm whether a user exists, which the Nmap smtp-enum-users script automates. Disable VRFY and EXPN, return uniform responses and rate-limit.

Security considerations for all of these: enumeration needs no exploit, only a service that answers too freely, so the fix is configuration. Log failed binds and rapid sequences of queries from a single host, and alert on them.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a DNS zone transfer (AXFR) request return when the server allows it to anyone?

    Zone transfers replicate the whole zone. They should be limited to named secondary servers.
  2. 2. Why are the SNMP community strings public and private a problem?

    SNMPv1 and v2c rely on a shared word as the only access control. SNMPv3 adds authentication and encryption.
  3. 3. Which change most directly stops anonymous LDAP directory browsing?

    An anonymous bind lets anyone search the directory. Requiring authentication and encryption removes that exposure.
  4. 4. How does SMTP user enumeration work without VRFY?

    Accepted and rejected recipients reveal which mailboxes exist. Uniform responses and rate limits reduce the leak.

Summary

  • Enumeration is active recon: asking discovered services what they will reveal. It needs authorization.
  • SMB null sessions, default SNMP community strings, anonymous LDAP binds, SMTP VRFY and open DNS zone transfers are classic leaks.
  • Most enumeration uses normal protocol questions, which is why misconfiguration is so common.
  • Fixes are restriction, authentication, encryption (SNMPv3, LDAP over TLS, SMB signing) and removing unused services.
  • Defenders detect enumeration by counting repeated lookups or failures per source and by alerting on unusual requests such as AXFR.

Next: Content Discovery with Gobuster and Nikto