Module 04 Enumeration
Module 04 Enumeration
Introduction
Enumeration is the process of actively gathering detailed information about a target system,
network, or application to identify vulnerabilities and potential entry points. It involves probing
services, extracting user and group details, identifying running applications, and mapping network
resources. This phase is essential in penetration testing and vulnerability assessments, bridging the
gap between reconnaissance and exploitation by providing actionable insights into the target
environment.
At the conclusion of this module, you will be able to:
⮚ Illustrate concepts related to enumeration
⮚ Explain various methods for enumerating NetBIOS
⮚ Describe different approaches to SNMP enumeration
⮚ Outline several techniques for LDAP and Active Directory (AD) enumeration
⮚ Discuss various methods for NTP enumeration
⮚ Explain different techniques for NFS enumeration
⮚ Detail the approaches for SMTP and DNS enumeration
⮚ Describe additional enumeration techniques such as IPsec, VoIP, RPC, Linux/Unix, and SMB
enumeration
⮚ Implement countermeasures for enumeration
Enumeration Concepts
Enumeration is a vital phase in penetration testing where active connections to target systems
reveal detailed information about architecture, users, and services. Building on reconnaissance, it
transitions from passive observation to active probing to uncover system details like usernames,
shared resources, and service banners. Techniques include querying network services, extracting
metadata, and using tools like Nmap and Metasploit. Key services and ports, such as NetBIOS/SMB
(137, 139, 445), SNMP (161), LDAP (389), SMTP (25), and DNS (53), along with protocols like NTP
and Telnet, are examined for insights into network topology and vulnerabilities, essential for
effective security assessments.
What is Enumeration?
In the Enumeration phase, an attacker initiates active connections with the target system. Through
this active connection, direct queries are generated to gain more information. This information
helps to identify the system’s attack points. Once an attacker discovers attack points, they can gain
unauthorized access by using the collected information to reach the assets.
The information enumerated in this phase is:
Module 04: Enumeration
● Routing Information
● SNMP Information
● DNS Information
● Machine Name
● User Information
● Group Information
● Application and Banners
● Network Sharing Information
● Network Resources
While enumerating, attackers might encounter a remote Inter-Process Communication (IPC)
share, like IPC$ in Windows, which they can investigate further to access an administrative share
by attempting to guess admin credentials, allowing them to acquire full details regarding the file-
system listing that the share denotes.
The previous modules demonstrated the methods attackers use to collect essential information
about a target without any illegal activity. Nevertheless, enumeration practices could be considered
illegal, depending on the regulations set by the organization and the applicable laws. A penetration
tester or an ethical hacker needs to obtain the necessary permission before conducting
enumeration.
Techniques for Enumeration
The following techniques are used to gather information about a target:
Extract User Name using an Email ID
Using an Email ID to extract information can provide useful information such as username, domain
name, etc. An email address usually contains the username and domain name, formatted as:
username@domainname
Extract Information using the Default Password
Another way of enumeration is by using default passwords. Every device and software has default
credentials and settings. It is recommended that these default settings and configurations be
changed. Certain administrators continue to utilize default passwords and configurations, making
it very easy for an attacker to gain unauthorized access by using default credentials. Finding default
settings, configurations, and passwords of devices is no longer difficult.
Brute force AD
Active Directory (AD) offers a centralized way to manage and control computers, domain users,
and network printers. It restricts access to network resources to defined users and computers. The
AD is a big target as it is a good source of sensitive information for an attacker. Brute forcing or
generating queries to LDAP services helps to gather information such as username, address,
credentials, privileges information, etc.
Module 04: Enumeration
Microsoft Active Directory is vulnerable to username enumeration during the verification of user-
supplied input. This flaw arises from how Microsoft Active Directory is designed. When a user
activates the “logon hours” feature, every attempt at service authentication yields different error
messages. Malicious actors exploit this to identify valid usernames. If an attacker manages to obtain
valid usernames, they can execute a brute-force attack to gain access to the corresponding
passwords.
Extract information using DNS Zone Transfer
Enumeration through the DNS zone transfer process includes extracting information such as the
DNS server's location, DNS Records, and other valuable network-related information like
hostname, IP address, username, etc. A zone transfer is a process of updating DNS servers; a zone
file carries valuable information that an attacker can retrieve. UDP port 53 is used for DNS requests.
TCP 53 is utilized for DNS zone transfers to ensure that the transfer goes through.
A network administrator can use DNS zone transfer to replicate DNS data across servers or back up
DNS files by executing a zone transfer request. If permitted, the name server will convert DNS
names and IP addresses to ASCII text. Improperly configured DNS servers can inadvertently expose
organizational information, including lists of hosts, sub-zones, and IP addresses. Zone transfers can
be performed using nslookup and dig commands.
Extract user groups from Windows
To obtain user groups from Windows, the individual must have a registered account as a user within
the Active Directory. The individual can subsequently retrieve information from the groups they
belong to by utilizing either the Windows interface or command-line approaches.
Extract usernames using SNMP
Enumeration using SNMP is a process of collecting information through SNMP. The attacker
utilizes default community strings or attempts to guess the string in order to retrieve information
pertaining to a device. The SNMP protocol was developed to allow administrators to manage
devices such as servers, routers, switches, and workstations on an IP network. It enables network
administrators to manage the performance of the network, troubleshoot and resolve network
problems, as well as design a highly available and scalable plan for network growth. SNMP is an
application layer protocol. It provides communication between managers and agents. The SNMP
system consists of three elements:
● SNMP Manager
● SNMP Agents (managed node)
● Management Information Base (MIB)
Attackers can effortlessly deduce read-only or read-write community strings by leveraging the
SNMP Application Programming Interface (API) to retrieve usernames.
Extract network resources and topology using SNMP
Attackers can systematically probe the SNMP hierarchy to collect comprehensive data regarding
network resources and topology.
Module 04: Enumeration
service. There exists a vulnerability in the section of RPC responsible for transmitting messages over
TCP/IP. Improper handling of malformed messages leads to failures. This issue impacts the RPC
Endpoint Mapper, which operates on TCP/IP port 135. This security flaw could permit an attacker
to send RPC messages to the RPC Endpoint Mapper process on a server, potentially resulting in a
Denial-of-Service (DoS) attack.
UDP 137: NetBIOS Name Service (NBNS)
NBNS, which is also referred to as the Windows Internet Name Service (WINS), offers a service for
resolving names for computers that use NetBIOS. The servers for NetBIOS names keep a record of
the NetBIOS names associated with hosts and the IP addresses that those hosts utilize. The purpose
of NBNS is to correlate IP addresses with NetBIOS names and their associated queries. Typically,
attackers target the name service as their first point of attack. Generally, NBNS employs UDP 137 as
its primary transport protocol. For certain operations, it may also utilize TCP 137 as a transport
protocol, although this is unlikely to happen in practice.
TCP 139: NetBIOS Session Service (SMB over NetBIOS)
TCP 139 is arguably the most recognized Windows port. This port is utilized for transferring files
across a network. Systems rely on this port for both establishing null sessions and enabling file and
printer sharing. A system administrator who is contemplating limiting access to ports on a
Windows system should prioritize the restriction of TCP 139. A poorly configured TCP 139 port
could allow an attacker to gain unauthorized access to essential system files or the entire file system,
leading to data theft or other malicious activities.
TCP/UDP 445: SMB over TCP (Direct Host)
Windows enables file and printer sharing through the SMB protocol, which is hosted directly on
TCP. In previous operating systems, SMB traffic needed the NetBIOS over TCP (NBT) protocol to
function on TCP/IP transport. Directly hosted SMB traffic utilizes port 445 (TCP and UDP) rather
than NetBIOS.
UDP 161: Simple Network Management Protocol (SNMP)
SNMP is commonly utilized in network management systems to monitor devices connected to the
network, including routers, switches, firewalls, printers, and servers. It is made up of a manager and
agents. The agent listens for requests on port 161 from the managers and replies to them on port
162.
TCP/UDP 389: Lightweight Directory Access Protocol (LDAP)
LDAP is a protocol designed for the access and management of distributed directory information
services across an IP network. By default, LDAP operates over TCP or UDP as its transport protocol,
utilizing port 389.
TCP 2049: Network File System (NFS)
The NFS protocol facilitates the mounting of file systems from a remote host via a network, allowing
users to interact with these file systems as if they were mounted locally. NFS servers communicate
with their client systems through TCP port 2049. If the NFS services are not configured correctly,
Module 04: Enumeration
attackers might exploit the NFS protocol to gain control over a remote system, execute privilege
escalation, or inject backdoors or malware onto a remote host, among other threats.
TCP 25: Simple Mail Transfer Protocol (SMTP)
SMTP is a mail delivery protocol that operates over TCP/IP. It facilitates the transmission of emails
over the Internet and local networks. This protocol functions on the connection-oriented services
offered by TCP and utilizes the commonly recognized port number 25. The following table outlines
several commands utilized by SMTP along with their corresponding syntaxes.
in comparison to protocols like FTP/S, which need multiple ports to function. The fact that SFTP
depends on a single port simplifies its implementation while still ensuring secure data transfers
through SSH encryption. Attackers may scan SFTP to obtain information regarding user accounts,
file and directory permissions, and the configuration of the server.
TCP/UDP 3268: Global Catalog Service
Microsoft’s Global Catalog server serves as a domain controller that holds additional information
and operates on port 3268. Its database comprises entries for every object in the entire organization
rather than just those in a single domain. The Global Catalog enables users to find objects from any
domain without needing to know the domain's name. The LDAP protocol on the Global Catalog
server operates over port 3268. This service is active on port 3268 via a TCP connection.
Administrators utilize port 3268 to troubleshoot with the Global Catalog by establishing a
connection using LDP.
TCP/UDP 5060, 5061: Session Initiation Protocol (SIP)
The Session Initiation Protocol (SIP) is a protocol utilized in Internet telephony for making voice
and video calls. It generally employs TCP/UDP port 5060 for non-encrypted signaling traffic or 5061
for encrypted communications using TLS when connecting to servers and other endpoints.
TCP 20/21: File Transfer Protocol
FTP is a protocol that establishes a connection for transferring files across the Internet and private
networks. It operates on TCP port 21 for control commands, while data transfer utilizes TCP port
20 or various dynamic port numbers based on the server setup. If attackers discover that the FTP
server ports are open, they carry out enumeration on the FTP service to gather details like the
software version and any existing vulnerabilities, which can lead to further exploits such as
intercepting FTP traffic and executing brute-force attacks against FTP.
TCP 23: Telnet
The Telnet protocol is utilized for remote management of various network devices. It is considered
an insecure protocol as it sends login information in cleartext. Consequently, it is primarily
employed within private networks. The Telnet server accepts connections from clients on port 23.
Malicious actors can exploit the Telnet protocol for activities like banner grabbing on other
protocols, including SSH and SMTP, conducting brute-force attacks on login credentials, and
executing port forwarding attacks.
UDP 69: Trivial File Transfer Protocol (TFTP)
TFTP is a protocol that operates without a connection and is utilized for file transfers over the
Internet. Because TFTP is reliant on connectionless UDP, it does not ensure that files are
transmitted correctly to their intended destination. This protocol is primarily employed to update
or upgrade the software and firmware of connected devices from a distance. It utilizes UDP port 69
for sending files to a remote server. Cyber attackers might take advantage of TFTP to introduce
harmful software or firmware onto remote devices.
Module 04: Enumeration
NetBIOS Enumeration
This part outlines the process of NetBIOS enumeration, the types of information gathered, and the
different tools used for NetBIOS enumeration. NetBIOS is prioritized for enumeration since it
reveals a substantial amount of sensitive data regarding the target network, including details about
users and shared network resources.
The initial action in gathering information about a Windows system involves utilizing the NetBIOS
API. NetBIOS was initially created as an API to enable client applications to connect to resources
on a Local Area Network (LAN). Windows employs NetBIOS for the sharing of files and printers.
NetBIOS stands for Network Basic Input/Output System. This program facilitates communication
among various applications operating on different systems within a local area network. NetBIOS
utilizes a distinct 16-character ASCII string to identify network devices via TCP/IP. The first 15
characters serve to identify the device, while the 16th character designates the service. The NetBIOS
service operates on TCP port 139. NetBIOS over TCP (NetBT) employs the following TCP and UDP
ports:
● UDP port 137 (name services)
● UDP port 138 (datagram services)
● TCP port 139 (session services)
Attackers commonly target the NetBIOS service because it is easy to exploit and often runs on
Windows systems even when not in use. They utilize NetBIOS enumeration to gather the following
information:
● List of machines within a domain
● File sharing
● Printer sharing
● Username
● Group information
● Password
● Policies
If an attacker discovers a Windows system with port 139 open, they can investigate which resources
on that remote system can be accessed or viewed. For NetBIOS name enumeration to be possible,
the remote system must have file and printer sharing enabled. This enumeration could allow the
attacker to read from or write to the remote computer system, depending on the available shares.
Additionally, it could enable the attacker to launch a Denial-of-Service (DoS) attack.
Module 04: Enumeration
EXAM TIP: Microsoft does not provide support for NetBIOS name resolution in IPv6.
Nbtstat Utility
Nbtstat is a utility in Windows designed to assist in diagnosing issues related to NETBIOS name
resolution. The nbtstat command is utilized to eliminate and rectify preloaded entries with the help
of various case-sensitive options. Attackers may leverage Nbtstat to gather details such as statistics
on the NetBIOS over TCP/IP (NetBT) protocol, as well as the NetBIOS name tables for both local
and remote systems, along with the NetBIOS name cache.
The command syntax for nbtstat is outlined as follows:
nbtstat [-a <remotename>] [-A <IPaddress>] [-c] [-n] [-r] [-R] [-RR] [-s] [-S] [<interval>][-?]
Table 4-04 lists various Nbtstat parameters and their respective functions.
Module 04: Enumeration
Figure 4-01: Nbtstat Command to Obtain the Name Table of a Remote System
Example 2:
nbtstat –c
This command can be run to retrieve the contents of the NetBIOS name cache, which includes a
list of NetBIOS names and their associated resolved IP addresses.
Figure 4-02: Nbtstat Command to obtain the Contents of the NetBIOS Name Table
NetBIOS Enumeration Tools
NetBIOS enumeration tools investigate and scan a network across specific ranges of IP addresses
and lists of computers to uncover security vulnerabilities or weaknesses in connected systems.
These tools also identify Operating Systems (OSs), users, groups, Security Identifiers (SIDs),
password policies, services, service packs and hotfixes, NetBIOS shares, transports, sessions, disks,
and security event logs, among other things.
Module 04: Enumeration
NetBIOS Enumerator
The NetBIOS Enumerator is a tool used for enumeration that demonstrates how to utilize remote
network support and manage various web protocols, including SMB. As illustrated in Figure 4-03,
attackers utilize the NetBIOS Enumerator to gather information such as NetBIOS names,
usernames, domain names, and Media Access Control (MAC) addresses within a specified range of
IP addresses.
PsFile
PsFile is a command-line tool that displays a list of files on a system that have been accessed
remotely, and it can terminate opened files by either their name or file identifier. By default, PsFile
lists the files on the local system that are opened by remote devices. Entering a command followed
by a "-" will show the syntax information for that command.
The syntax for using the PsFile command is as follows:
psfile [\\RemoteComputer [-u Username [-p Password]]] [[Id | path] [-c]]
PsGetSid
PsGetSid converts SIDs into their corresponding display names and the other way around. It
functions with built-in accounts, domain accounts, and local accounts. Additionally, it shows the
SIDs associated with user accounts and can convert an SID into the name that corresponds to it. It
is capable of querying SIDs remotely across the network.
The command syntax for PsGetSid is as follows:
psgetsid [\\computer[,computer[,...] | @file] [-u username [-p password]]] [account|SID]
PsKill
PsKill is a utility designed to terminate processes on both remote systems and the local machine.
By specifying a process ID, PsKill will kill the corresponding process on the local computer. If a
process name is provided, PsKill will kill all processes of that name. It is not necessary to install a
client on the target machine in order to use PsKill to end a remote process.
The command structure for PsKill is as follows:
pskill [-] [-t] [\\computer [-u username] [-p password]] <process name | process id>
PsInfo
PsInfo is a command-line utility that collects essential details about local or remote legacy Windows
systems, such as the type of installation, the kernel version, the registered owner and organization,
the number of processors along with their types, the size of physical memory, the system's
installation date, and the expiration date for trial versions. By default, PsInfo displays information
for the local machine. To retrieve details from a remote computer, you can specify its name.
The syntax for using the PsInfo command is as follows:
psinfo [[\\computer[,computer[,..] | @file [-u user [-p psswd]]] [-h] [-s] [-d] [-c [-t delimiter]]
[filter]
PsList
PsList is a command-line utility that provides information on Central Processing Unit (CPU) usage
and memory statistics, as well as thread data. The tools from the Resource Kits, pstat and pmon
present various types of information solely for the processes running on the respective system
where the tools are executed.
Module 04: Enumeration
PsLoggedOn
PsLoggedOn is a utility that shows both users who are logged in locally and those accessing the
system through shared resources, whether on the local machine or a remote one. When a username
is provided instead of a computer name, PsLoggedOn scans the computers in the network
neighborhood to check if that user is currently signed in. PsLoggedOn defines a user logged in
locally as one whose profile is loaded into the registry. Consequently, PsLoggedOn identifies
logged-in users by examining the keys located under the HKEY_USERS key. For each key with a
name or user SID, PsLoggedOn retrieves the matching username and presents it. To find out which
users have accessed a computer via resource shares, PsLoggedOn employs the NetSessionEnum
API.
The command syntax for PsLoggedOn is as follows:
psloggedon [-] [-l] [-x] [\\computername | username]
PsLogList
The elogdump utility allows you to extract the contents of an Event Log from either a local or
remote system. PsLogList serves as a counterpart to elogdump, but it can connect to remote
machines even when the user's security credentials might restrict access to the Event Log, and it
gathers message strings from the computer that holds the event log. By default, PsLogList's function
is to present the contents of the System Event Log on the local machine with a user-friendly visual
format.
The command syntax for PsLogList is as follows:
psloglist [-] [\\computer[,computer[,...] | @file [-u username [-p password]]] [-s [-t delimiter]] [-
m #|-n #|-h #|-d #|-w][-c][-x][-r][-a mm/dd/yy][-b mm/dd/yy][-f filter] [-i ID[,ID[,...] | -e
ID[,ID[,...]]] [-o event source[,event source][,..]]] [-q event source[,event source][,..]]] [-l event
log file] <eventlog>
PsPasswd
PsPasswd allows for changing an account's password on both local and remote machines, and
system administrators can develop batch files to execute PsPasswd on the systems they oversee to
execute a mass password change for the administrator. PsPasswd utilizes Windows password reset
APIs, ensuring that passwords are not transmitted over the network in plaintext format.
The command syntax for PsPasswd is as follows:
Attackers may employ ChatGPT for this purpose by using suitable prompts like:
Example 1:
Perform NetBIOS enumeration on target IP [Link].
nbtscan [Link]
The nbtscan command is utilized to conduct NetBIOS enumeration on the specified IP address
[Link].
Example 2:
Get NetBIOS info for IP [Link] and display the associated names.
Figure 4-08: Perform NetBIOS Enumeration on Target IP and Display the Names
The following prompt is designed to automate NetBIOS enumeration on the specified target IPs:
nmblookup -A [Link]
The nmblookup command, when used with the -A option, retrieves NetBIOS details for the
specified IP address [Link] and shows the corresponding names.
Example 3:
SNMP Enumeration
The Simple Network Management Protocol (SNMP) enables network administrators to manage
devices remotely. SNMP enumeration is a method used to gather information about user accounts
and devices by targeting the most commonly utilized network management protocol, SNMP. SNMP
requires a community string to authenticate the management station.
Nonetheless, SNMP has numerous security weaknesses, including a lack of auditing capabilities.
Attackers can exploit these vulnerabilities for account and device enumeration. This section
outlines SNMP enumeration, the types of information obtained through this process, and various
tools utilized for enumerating user accounts and devices on a target system.
SNMP is an application-layer protocol that operates over UDP and is responsible for maintaining
and managing routers, hubs, and switches within an IP network. Agents of SNMP can be found on
both Windows and Unix networks within networking devices.
Module 04: Enumeration
SNMP enumeration refers to the method of compiling a list of user accounts and devices present
on a target computer via SNMP. SNMP communicates using two main software components: the
SNMP agent and the SNMP management station. The SNMP agent resides on the networking
device, while the SNMP management station interacts with the agent.
Nearly all infrastructure devices in a network, like routers and switches, have an SNMP agent for
system or device management. The SNMP management station dispatches requests to the agent,
which then responds after processing the request. Both the requests and responses involve
configuration variables that the agent software can access. The SNMP management stations send
requests to modify certain variable values. Traps inform the management station about any
abnormal events, such as a reboot or an interface failure, occurring on the agent's side.
SNMP includes two passwords that are used for configuring and accessing the SNMP agent from
the management station.
1. Read Community String
● This password allows users to view the configuration of the device or system.
● These strings are considered public
2. Read/Write Community String
● This password enables users to modify or edit the device configuration
● These strings are deemed private
When administrators leave the community strings set to their default values, attackers can exploit
these default community strings (passwords) to change or access the device or system's
configuration. Attackers perform SNMP enumeration to gather information about network
resources such as hosts, routers, devices, and shares, along with network information, including
ARP tables, routing tables, device-specific details, and traffic statistics.
Common tools for SNMP enumeration include OpUtils ([Link] and
Network Performance Monitor ([Link]
Working of SNMP
Module 04: Enumeration
c. Set Request
The SNMP manager utilizes Set Requests to alter the value of a variable in the agent's MIB, thereby
modifying the configuration or functionality of the network device.
d. GetBulk Request
Introduced in SNMPv2, this function facilitates the acquisition of large amounts of data with a
single request, enhancing efficiency compared to multiple GetNext Requests.
e. Response
Following the reception of a Get, GetNext, Set, or GetBulk request, the SNMP agent evaluates the
request, executes the required actions, and returns a Response PDU containing the requested data
or an acknowledgment of the executed action.
f. Inform Request
An SNMP agent employs Inform Requests to convey unsolicited information to the SNMP manager,
typically regarding significant occurrences or errors. This mechanism is also utilized for
communication between managers.
g. Trap
Traps are unsolicited notifications dispatched from an SNMP agent to the manager to inform it of
important events or network changes, such as a device reboot or a link failure. SNMPv3 introduced
the idea of Notifications, which encapsulates both Traps and Informs, providing added
authentication and encryption.
Monitoring and Management
The SNMP manager leverages the data gathered from SNMP agents to assess network performance,
identify and resolve issues, and manage network devices remotely. This continuous process involves
regular polling (sending Get Requests) and monitoring for Traps or Inform Requests from agents.
Management Information Base (MIB)
MIB serves as a virtual database that offers a formal outline of all network entities managed by
SNMP. It consists of information that is organized hierarchically. This structure supplies a
standardized representation of the data and storage of the SNMP agent. The elements within the
MIB are identified by Object Identifiers (OIDs). An OID is a numeric designation assigned to an
object, starting from the root of the MIB tree. It can distinctly identify the object within the MIB
hierarchy.
Objects managed by the MIB include scalar objects, which specify a single instance, and tabular
objects, which outline a collection of related instances. OIDs encompass the object's type (such as
counter, string, or address), the access level (like read or read/write), size limitations, and range
specifications. The SNMP manager translates the OIDs into a format that is easily understood by
using the MIB as a reference guide.
Module 04: Enumeration
Users can view the MIB contents through a web browser by entering either the IP address followed
by [Link] or the DNS library name with [Link]. For instance, they can use
[Link] or [Link] Microsoft offers a list of MIBs
included with the SNMP service in the Windows resource kit. The key MIBs include:
● [Link]: Tracks network activity between DHCP servers and remote clients
● [Link]: Oversees and regulates host resources
● [Link]: Contains object types for both workstation and server services
● MIB_II.MIB: Administers TCP/IP-based Internet using a simple architecture and system
● [Link]: For the Windows Internet Name Service (WINS)
Enumerating SNMP using SnmpWalk
Simple Network Management Protocol (SNMP) nodes immediately detect and delineate a variety
of variables accessible within the target network. With this tool, attackers focus on the root node
to extract information from all the sub-nodes, including routers and switches. This information can
be accessed through an Object Identifier (OID), which is linked to the Management Information
Base (MIB) for devices that have SNMP enabled. Attackers use the following command to pull
SNMP details from the target device:
Attackers utilize the Nmap Scripting Engine (NSE) script called snmp-processes to gather information about the SNMP services running on a remote server.
Internet Information Services (IIS) metrics, IP forwarding settings, active UDP ports, locations,
mountpoints, network interfaces, network services, routing data, software components, system
uptime, TCP connections, total memory, uptime, and user accounts.
Figure 4-13: Screenshot of snmp-check showing System Information and User Accounts
Module 04: Enumeration
Perform SNMP enumeration on target IP [Link] using nmap and display the result here.
Perform SNMP processes on target IP [Link] using nmap and display the result here.
LDAP Enumeration
Different protocols facilitate communication and manage data transfer between network resources.
Each of these protocols transmits critical information regarding network resources alongside the
data. An external user who successfully gathers this information by exploiting the protocols can
infiltrate the network and may misuse its resources. The Lightweight Directory Access Protocol
(LDAP) is one such protocol that retrieves directory listings. This section will examine LDAP
enumeration, the types of information obtained through LDAP enumeration, and tools used for
LDAP enumeration.
LDAP is an open standard internet protocol. LDAP is used for accessing and maintaining
distributed directory information services in a hierarchical and logical structure. A directory service
plays an important role by allowing information such as user, system, network, service information,
Module 04: Enumeration
etc., to be shared throughout the network. LDAP provides a central place to store usernames and
passwords. Applications and services connect to the LDAP server to validate users. The client
initiates an LDAP session by sending an operation request to the Directory System Agent (DSA)
using TCP port 389. The communication between the client and server uses Basic Encoding Rules
(BER). Directory services using LDAP include:
● Active Directory
● Open Directory
● Oracle iPlanet
● Novell eDirectory
● OpenLDAP
An attacker can anonymously request sensitive data from the LDAP service, including usernames,
addresses, departmental information, and server names, which can then be exploited to carry out
further attacks.
Manual and Automated LDAP Enumeration
Attackers may employ either manual or automated methods to perform LDAP enumeration. Below
are some commands that can be utilized for LDAP enumeration:
Manual LDAP Enumeration
Attackers can execute manual LDAP enumeration using Python. Adhere to the steps described
below in order to perform manual LDAP enumeration using Python:
1. Use Nmap to verify if the target LDAP server is operational on port 389 for LDAP and port 636
for secure LDAP.
2. If the target server is active on the indicated ports, initiate the enumeration by installing LDAP
with the following command:
pip3 install ldap3
3. As demonstrated in the following code, create a server object (server) and provide the target IP
address or hostname along with the port number. If the target server is using secure LDAP, set:
use_ssl = True
4. Obtain the Directory System Agent (DSA) specific entry (DSE) naming contexts by specifying:
get_info = [Link]
5. Next, create a connection object, named connection, and make a call to bind().
6. If the binding is successful, True will be displayed on the screen as shown below:
>>> import ldap3
>>> server = [Link]('Target IP Address', get_info = [Link], port = 389)
>>> connection = [Link](server)
>>> [Link]()
True
Module 04: Enumeration
7. You can now retrieve information such as the domain name and naming context using the script
below:
>>> [Link]
Figure 4-22: Screenshot showing Output of the Nmap ldap-brute NSE Script
EXAM TIP: Custom lists can be utilized by employing the userdb and passdb script
arguments.
LDAP Enumeration Tools
Numerous LDAP enumeration tools are available that can access directory listings in Active
Directory (AD) or other directory services. By employing these tools, attackers can gather
information, including valid usernames, addresses, and departmental information from various
LDAP servers.
Softerra LDAP Administrator
Softerra LDAP Administrator is a tool used for managing LDAP directories and is compatible with
LDAP servers like Active Directory (AD), Novell Directory Services, and Netscape/iPlanet. It allows
users to navigate and administer LDAP directories. As illustrated in the screenshot, malicious actors
utilize Softerra LDAP Administrator to gather information about users, including their usernames,
email addresses, and departments.
Module 04: Enumeration
For instance, from the output of this command, if the primary domain component is identified as
DC=htb,DC=local, the subsequent command can be used to retrieve further information about
the primary domain:
ldapsearch -h <Target IP Address> -x -b “DC=htb,DC=local”
The following commands can be utilized to access information regarding a particular object or all
the objects within a directory tree:
The command below fetches a list of users associated with a specific object class:
ldapsearch -h <Target IP Address> -x -b "DC=htb,DC=local" '(objectClass= Employee)'
sAMAccountName sAMAccountType
Network administrators frequently neglect the importance of the Network Time Protocol (NTP)
server when assessing security measures. However, if utilized correctly, it can reveal significant
network details to an attacker. Therefore, understanding the information an attacker might derive
from NTP enumeration is essential. The Network File System (NFS) facilitates the management of
access to remote files. NFS enumeration enables attackers to collect data such as a list of clients
connected to the NFS server, their IP addresses, and the directories that have been exported. This
section outlines NTP enumeration, the types of information obtained through NTP enumeration,
different NTP enumeration commands, tools for NTP enumeration, as well as techniques and tools
for NFS enumeration.
NTP Enumeration
NTP stands for Network Time Protocol and is used in a network to synchronize the clocks across
the hosts and network devices. NTP is an important protocol, as directory services, network devices,
and hosts rely on clock settings for login and logging purposes to keep a record of events. NTP helps
in correlating events by time system logs are received by Syslog servers. NTP uses UDP port 123,
and its whole communication is based on Coordinated Universal Time (UTC).
NTP uses a term known as stratum to describe the distance between the NTP server and the device.
It is just like a TTL number that decreases with every hop when a packet passes by. The stratum
value, starting from one, increases with every hop. For example, if we see stratum number 10 on a
local router, it means that the NTP server is nine hops away. Securing NTP is also an important
aspect. The attacker may alter timings to mislead the forensic teams who investigate and correlate
the events to find the root cause of the attack.
NTP is intended to synchronize the clocks of computers that are connected to a network. It utilizes
UDP port 123 as its main communication method. NTP can maintain time accuracy within an error
margin of 10 ms across the public Internet. Additionally, it can reach an accuracy of 200 μs or better
in Local Area Networks (LANs) under optimal conditions.
An attacker can gather the following information through queries to an NTP server:
● Information of the host connected to the NTP server
● Client’s IP address, machine’s name, Operating System information
● Network information such as internal IPs or topology maps may be disclosed from NTP
packets depending upon the deployment of the NTP server, i.e., if the NTP server is
deployed in DMZ
NTP Enumeration Commands
Commands for NTP enumeration, including ntpdate, ntptrace, ntpdc, and ntpq, are utilized to
query important information from an NTP server.
Module 04: Enumeration
ntpdate
This command gathers the number of time samples from multiple time sources. Its syntax is
outlined as follows:
ntpdate [-46bBdqsuv] [-a key] [-e authdelay] [-k keyfile] [-o ersion] [-p samples] [-t timeout] [ -
U user_name] server [...]
The image outlines various parameters and their corresponding functions for an NTP-related
command. Below is a textual representation of the table:
Module 04: Enumeration
Figure 4-25: Screenshot of the ntpdate Command, showing Debugging Information for a Given IP
ntptrace
ntptrace is a Perl script that uses ntpq to follow the chain of NTP servers from a given host back to
the primary time source. ntptrace requires implementing the NTP Control and Monitoring Protocol
specified in RFC 1305, and NTP Mode 6 packets are enabled to work properly.
This command identifies the source from which the NTP server receives its time and outlines the
sequence of NTP servers leading back to its main time source. Malicious actors utilize this
command to investigate the series of NTP servers linked to the network. The format is as follows:
ntptrace [-n] [-m maxhosts] [servername/IP_address]
ntpdc
ntpdc is used for questioning the ntpd daemon regarding the current state and requested changes
in state. Attackers utilize this command to obtain the status and statistics of every NTP server
linked to the targeted network. The syntax is outlined below:
ntpdc [ -46dilnps ] [ -c command] [hostname/IP_address]
ntpq> version
ntpq [email protected]
ntpq> host
current host is localhost
EXAM TIP: In several Linux distributions, the NTP daemon ntpd has been integrated with
Chrony, known as chronyd. Both daemons ensure that the local system's time is synchronized
with a remote time server.
NTP Enumeration Tools
NTP enumeration tools are utilized to oversee the operation of NTP and SNTP servers within the
network and assist in setting up and confirming the connectivity between the time client and the
NTP servers.
Module 04: Enumeration
servers on the network. In Windows Server, the NFS protocol includes NFS Server and Client
features.
Enumerating NFS services allows attackers to discover the exported directories, see which clients
are connected to the NFS server along with their IP addresses, and access the shared data linked to
those IP addresses. Once this information is collected, attackers can impersonate the IP addresses
to gain complete access to the files shared on the server.
As illustrated in Figure 4-29, an attacker executes the rpcinfo command to probe the target IP
address for an open NFS port (port 2049) and the NFS services operating on it.
rpcinfo -p <Target IP Address>
Figure 4-29: Screenshot of rpcinfo Command Displaying Open NFS Port and Services
As displayed in Figure 4-30, an attacker executes the subsequent command to check the list of
shared files and folders:
showmount -e <Target IP Address>
Module 04: Enumeration
Figure 4-31: Screenshot of RPCScan displaying Open NFS Ports and Services
SuperEnum
SuperEnum comes with a script designed to carry out fundamental enumeration on any open port.
In the example shown in Figure 4-32, a malicious user executes the ./superenum script and inputs
a text file named [Link], which contains either a specific IP address or a list of IP addresses for
the enumeration process.
This section outlines various enumeration methods to gather information about network resources.
It also addresses techniques for DNS enumeration that provide insights into the DNS servers and
the network infrastructure of the target organization. The section elaborates on both SMTP and
DNS enumeration methodologies, detailing SMTP enumeration, which involves acquiring a list of
legitimate users on an SMTP server, along with tools for SMTP enumeration, DNS zone transfer
enumeration, DNS cache snooping, and DNS zone walking.
SMTP Enumeration
SMTP Enumeration is another way to extract information about the target by using a Simple Mail
Transfer Protocol (SMTP). SMTP Protocol ensures the mail communication between email servers
and recipients over internet port 25. SMTP is one of the most popular TCP/IP protocols widely used
by most email servers, now defined in RFC 821.
Email systems typically utilize SMTP along with POP3 and IMAP, allowing users to store messages
in a server mailbox and retrieve them from the server when needed. SMTP relies on mail exchange
(MX) servers to route email through DNS. It operates over TCP ports 25, 2525, or 587.
SMTP provides the following three built-in commands:
VRFY
Validates users.
$ telnet [Link] 25
Trying [Link]...
Connected to [Link].
Escape character is '^]'.
220 NYmailserver ESMTP Sendmail 8.9.3
HELO
501 HELO requires domain address
HELO x
250 NYmailserver Hello [[Link]], pleased to meet you
VRFY Jonathan
250 Super-User <Jonathan@NYmailserver>
VRFY Smith
Module 04: Enumeration
$ telnet [Link] 25
Trying [Link]...
Connected to [Link].
Escape character is '^]'.
220 NYmailserver ESMTP Sendmail 8.9.3
HELO
501 HELO requires domain address
HELO x
250 NYmailserver Hello [[Link]], pleased to meet you
EXPN Jonathan
250 Super-User <Jonathan@NYmailserver>
EXPN Smith
550 Smith... User unknown
RCPT TO
Defines the recipients of the message.
$ telnetl [Link] 25
Trying [Link] ...
Connected to [Link].
Escape character is '^]'.
220 NYmailserver ESMTP Sendmail 8.9.3
HELO
HELO x
250 NYmailserver Hello [[Link]], pleased to meet you
MAIL FROM:Jonathan
250 Jonathan... Sender ok
RCPT TO:Ryder
250 Ryder... Recipient ok
RCPT TO: Smith
550 Smith... User unknown
501 HELO requires domain address
SMTP servers exhibit varying behaviors when responding to VRFY, EXPN, and RCPT TO commands
for both valid and invalid users, thus making it possible to identify legitimate users on the SMTP
server. Attackers can engage with SMTP through the Telnet command line and compile a roster of
valid users on the SMTP server.
Administrators and penetration testers can execute SMTP enumeration with command-line tools
such as Telnet and netcat or by utilizing software like Metasploit, Nmap, NetScanTools Pro, and
smtp-user-enum to gather information on valid users, delivery addresses, message recipients, and
more.
SMTP Enumeration using Nmap
Module 04: Enumeration
Attackers utilize Nmap to gather details from the intended SMTP server. They extract information
from the target SMTP server by employing different SMTP commands found in the Nmap Scripting
Engine (NSE) scripts.
The command listed below, when run, displays all the SMTP commands found in the Nmap
directory:
Step 5: Enter the command show advanced to see the full list of available options in the SMTP user
enumeration module.
Module 04: Enumeration
SMTP enumeration tools are utilized to carry out username enumeration. Attackers can leverage
the usernames gathered from this process to initiate additional attacks on other systems within the
network.
NetScanTools Pro
NetScanTools Pro’s SMTP Email Generator utility assesses the functionality of dispatching an email
via an SMTP server. Malicious actors utilize NetScanTools Pro for SMTP enumeration to gather all
email header details, which encompass confirm/urgent flags. Additionally, attackers can document
the email session in a log file and subsequently examine the interactions between NetScanTools
Pro and the SMTP server within that log file.
Figure 4-42: Screenshot of Linux DNS Zone Transfer using dig Command
nslookup Command
Attackers utilize the nslookup command on Windows systems to request information from DNS
name servers, such as the host addresses, name servers, and mail exchanges associated with the
target. As illustrated in Figure 4-43, attackers execute the command below to carry out a DNS zone
transfer:
nslookup
set querytype=soa
<target domain>
The command mentioned above configures the query type to the Start of Authority (SOA) record
in order to obtain administrative details about the DNS zone for the target domain
[Link].
The following command is utilized to try to transfer the zone of the designated name server:
Figure 4-43: Screenshot of Windows DNS Zone Transfer using the nslookup Command
DNSRecon
Attacker utilizes DNSRecon to verify all Name Server (NS) records associated with the target
domain for potential zone transfers. As demonstrated in the screenshot, these attackers execute the
subsequent command for performing a DNS zone transfer:
dnsrecon -t axfr -d <target domain>
Table 4-10 describes each option used in the command.
Figure 4-45: Screenshot of a dig query for a Site that is not Cached
Recursive Method
In this technique, attackers aim to observe the DNS server by issuing a recursive query while using
the +recurse option in place of the +norecurse option. Like the non-recursive approach, the
attackers seek specific DNS records such as A, CNAME, PTR, CERT, SRV, and MX from the DNS
cache.
In this technique, the Time-To-Live (TTL) value is analyzed to ascertain how long the DNS record
will stay in the cache. The TTL value resulting from the query is then compared to the TTL that was
originally configured in the TTL field. If the TTL value in the result is lower than the initial TTL
value, this indicates that the record is cached, suggesting that someone on the system has accessed
that site. Conversely, if the requested record is not found in the cache, it will be stored in the cache
following the initial query.
Attackers utilize the same dig command as in the non-recursive approach but substitute the
+recurse option for the +norecurse option:
dig @<IP of DNS server> <Target domain> A +recurse
The TTL value for the domain [Link], as displayed in Figure 4-46, is quite high,
indicating that the domain record was likely not present in the cache at the time the query was
made.
Module 04: Enumeration
Figure 4-55: Perform DNS Cache Snooping on Target Domain with dig
The command below is intended to automate the process of DNS cache snooping for the specified
target domain by utilizing the dig command:
dig @[Link] [Link] +recurse
Table 4-11 describes each option used in the command.
Figure 4-56: Perform DNS Cache Snooping on Target Domain with dig – using Non-Recursive Method
This section covers IPsec, VoIP, RPC, Unix/Linux users, Telnet, SSH users, and SMB enumeration.
IPsec Enumeration
IPsec is the most widely used technology for both gateway-to-gateway (LAN-to-LAN) and host-to-
gateway (remote access) enterprise VPN implementations. IPsec ensures data protection by
utilizing various components like Encapsulating Security Payload (ESP), Authentication Header
(AH), and Internet Key Exchange (IKE) to secure communications between VPN endpoints.
The majority of IPsec-based VPNs rely on the Internet Security Association Key Management
Protocol (ISAKMP), which is part of IKE, to create, negotiate, modify, and remove Security
Associations (SA) and cryptographic keys within a VPN setting. Attackers can conduct
straightforward direct scanning for ISAKMP at UDP port 500 using tools like Nmap to obtain details
regarding the existence of a VPN gateway.
Execute the following command to perform an Nmap scan to check the status of ISAKMP over port
500:
# nmap –sU –p 500 <target IP address>
Module 04: Enumeration
Figure 4-57: Screenshot displaying an Nmap Scan Over Port 500 for ISAKMP
Attackers can use fingerprinting tools like ike-scan to gather sensitive details, which includes the
encryption and hashing algorithm, authentication type, key distribution algorithm, and SA
LifeDuration. During this scanning process, specifically designed IKE packets containing an
ISAKMP header are sent to the target gateway, and the responses are recorded.
The command used for the initial discovery of IPsec VPN with the ike-scan tool is:
# ike-scan –M <target gateway IP address>
● UDP backoff fingerprinting, where the response packet arrival times from the target
hosts are logged, and the observed retransmission backoff pattern is matched
against known patterns.
● Vendor ID fingerprinting, which compares the Vendor ID payloads from the VPN
servers to established Vendor ID patterns.
● Transform Enumeration: It can ascertain the transform attributes that the VPN server
supports for IKE phase 1 (such as encryption and hash algorithms).
● User Enumeration: For some VPN systems, it can reveal valid VPN usernames.
● Pre-Shared Key Cracking: It is capable of performing offline dictionary or brute-force
password cracking for IKE Aggressive Mode with pre-shared key authentication. This
process utilizes ike-scan to gather the hash and other parameters alongside the psk-crack,
which is included in the ike-scan package, to carry out the cracking.
IPsec Enumeration with AI
Attackers can utilize AI-driven technologies to improve and automate their network enumeration
activities. With the help of AI, they can easily carry out IPsec enumeration on the targeted domain.
For instance, an attacker might employ ChatGPT to complete this task by utilizing a suitable
prompt, such as:
Perform IPsec enumeration on target IP [Link] with nmap.
Figure 4-60: Screenshot displaying Svmap Scan for Enumerating SIP Details
Metasploit
Attackers utilize Metasploit’s SIP Username Enumerator to probe numeric usernames/extensions
of VoIP phones. Figure 4-61 illustrates an example of how to enumerate SIP using Metasploit.
transfer between various processes. Generally, RPC includes components such as a client, a server,
an endpoint, an endpoint mapper, a client stub, and a server stub, along with several dependencies.
The portmapper service operates on TCP and UDP port 111 to detect endpoints and provide clients
with information about the active RPC services. Identifying RPC endpoints can help attackers locate
any vulnerable services running on these ports. In environments secured by firewalls and other
protective measures, this portmapper service is frequently filtered. As a result, attackers often scan
large ranges of ports to find accessible RPC services that may be susceptible to direct exploitation.
Attackers employ the following Nmap scanning commands to detect the RPC services operating
within the network:
Figure 4-62: Screenshot displaying an Nmap Scan Result for RPC Enumeration
Furthermore, attackers employ utilities like NetScanTools Pro to gather the RPC details of the
targeted network. The RPC Info feature of NetScanTools Pro assists attackers in identifying and
reaching the portmapper daemon/service commonly operating on port 111 of Unix or Linux systems.
Module 04: Enumeration
Figure 4-63: Screenshot displaying NetScanTools Pro Tool for RPC Enumeration
Unix/Linux User Enumeration
A crucial step in enumeration is conducting user enumeration on Unix/Linux systems. This process
yields a list of users, including information such as usernames, hostnames, and the date and time
when each session began.
The command-line tools listed below can facilitate user enumeration on Unix/Linux.
rusers
The command rusers provides a list of users currently logged into remote computers or those within
the local network. Its output resembles that of the who command but pertains to machines on the
local network.
Its syntax is as follows:
/usr/bin/rusers [-a] [-l] [-u| -h| -i] [Host ...]
Table 4-13 describes each option used in the command.
Module 04: Enumeration
Figure 4-64: Screenshot displaying the Execution of the finger Command for User Enumeration
SMB Enumeration
The Server Message Block (SMB) is a protocol used for transporting data, primarily utilized by
Windows systems to allow shared access to files, printers, serial ports, and remote access to
Windows services. Typically, SMB operates on TCP port 445 or through the NetBIOS API using
UDP ports 137 and 138, as well as TCP ports 137 and 139. By leveraging the SMB service, users can
access and manage files and data located on a remote server. Additionally, the SMB service enables
application users to read, write, and alter files stored on the remote server. Networks utilizing this
service are particularly susceptible to SMB enumeration, which can reveal significant information
about the target system.
In SMB enumeration, attackers often engage in banner grabbing to gather details such as operating
system specifics and the versions of services in operation. With this knowledge, they can execute
various types of attacks, including SMB relay attacks and brute-force attacks. Tools for SMB
enumeration, like Nmap, SMBMap, enum4linux, nullinux, SMBeagle, and NetScanTool Pro, allow
attackers to carry out targeted scans on the SMB service that is active on port 445.
For example, as illustrated in Figure 4-65, attackers employ the following Nmap command to
enumerate the SMB service on the specified target IP address:
nmap -p 445 -A <target IP>
Table 4-15 describes each option used in the command.
Figure 4-67: Scan the Target IP for the Port using SMB with nmap
To check a target IP for accessible SMB ports using Nmap, you can utilize the following command:
nmap -p 445 --script smb-enum-shares [Link]
Table 4-16 describes each option used in the command.
scripts, attackers can effectively carry out a sequence of network enumeration commands to collect
information on a targeted domain.
For instance, an attacker might leverage ChatGPT to accomplish this task by employing a suitable
prompt such as:
Develop and execute a script that will automate network enumeration tasks on target IP range
[Link]/24.
#!/bin/bash
target_range="[Link]/24"
#Update system and install necessary tools
sudo apt-get update && sudo apt-get install -y nmap
#Create a directory for the enumeration outputs
mkdir -p ~/enumeration_results #Perform a ping sweep to find live hosts nmap -sn $target_range
-oN ~/enumeration_results/ping_sweep.txt
#Perform a quick scan on discovered hosts
nmap -T4 -F $target_range -oN ~/enumeration_results/quick_scan.txt
#Perform a detailed scan on discovered hosts
nmap -T4 -A $target_range -oN ~/enumeration_results/detailed_scan.txt
#Perform a version detection scan on discovered hosts
nmap -sV $target_range -oN ~/enumeration_results/version_detection.txt
#Execute the script
This script automates the network enumeration process by executing different Nmap scans on the
designated target IP range and storing the results in individual files for further analysis.
Enumeration Countermeasures
● Remove sensitive information from mail responses on mail servers and local hosts.
● Turn off the open relay feature.
● Limit accepted connections from any source to thwart brute-force attacks.
● Disable the EXPN, VRFY, and RCPT TO commands or restrict them to authenticated users.
● Dismiss emails aimed at unknown recipients by configuring SMTP servers accordingly.
● Utilize Machine Learning (ML) solutions to detect spammers.
● Refrain from disclosing internal IP/host details or mail relay system specifics.
● Implement Sender Policy Framework (SPF), Domain Keys Identified Mail (DKIM), and
Domain-based Message Authentication And Reporting & Conformance (DMARC).
● Set up the SMTP server to give limited information in error messages. Detailed responses
could provide attackers with insights into server configuration or valid user accounts.
● Use Access Control Lists (ACLs) to limit certain SMTP commands to authorized users or IP
addresses, preventing anonymous or unauthorized users from trying to gather user
information.
● Ensure the SMTP server necessitates authentication before granting access to any
information or allowing emails to be sent, which aids in preventing anonymous
enumeration attempts.
● Employ Transport Layer Security (TLS) to encrypt communications with the SMTP server,
ensuring that all data exchanged, including authentication credentials, is secure.
● Make sure the SMTP server records access attempts and commands used, and regularly
review these logs to spot any suspicious activity or attempted enumeration.
● Utilize security tools that can analyze log files and detect unusual behavioral patterns, such
as a significant number of failed login attempts, which might suggest an enumeration
attempt.
● Implement firewalls to manage access to the SMTP server, permitting only trusted IP
addresses or networks to connect.
● Enforce rate limiting to control the number of requests an IP address can make to the SMTP
server within a specific timeframe, helping to minimize brute-force attacks.
SMB Enumeration Countermeasures
Common file sharing services or other services that are not utilized can serve as entry points for
attackers looking to bypass network security measures. A network utilizing the SMB protocol is
particularly vulnerable to enumeration attacks. Since web and DNS servers do not need this
protocol, it is recommended to disable it on those servers. SMB can be turned off by disabling the
features Client for Microsoft Networks and File and Printer Sharing for Microsoft Networks in
Network and Dial-up Connections. For servers that are exposed to the Internet, often called bastion
hosts, SMB can also be disabled by turning off these same two features in the TCP/IP properties
dialog box. An alternative way to disable the SMB protocol on bastion hosts without specifically
turning it off, is to block the ports associated with the SMB service. These ports are TCP ports 139
and 445.
Module 04: Enumeration
Since turning off SMB services is not always practical, additional measures to counter SMB
enumeration may be necessary. The Windows Registry can be adjusted to limit anonymous access
from the Internet to a select group of files. These files and folders are listed in the settings for
Network access: Named pipes that can be accessed anonymously and Network access: Shares that
can be accessed anonymously. Implementing this configuration requires adding the
RestrictNullSessAccess parameter to the registry key located at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameter
s
The RestrictNullSessAccess parameter accepts binary values, where 1 indicates that it is enabled
and 0 indicates that it is disabled. Setting this parameter to 1 or enabling it restricts anonymous
users' access to the specified files listed in the Network access settings.
The following are additional countermeasures for defending against SMB enumeration:
● Make certain that the Windows Firewall or comparable endpoint protection tools are active
on the device.
● Apply the most recent security updates for Windows and any third-party applications.
● Establish a proper authentication method along with a robust password policy.
● Enforce strong permissions to safeguard stored data.
● Conduct regular reviews of system logs.
● Engage in proactive system monitoring to detect any malicious activities.
● Utilize secure VPNs to protect organizational data during remote access.
● Implement file behavioral analysis systems, such as Next-Generation Firewalls (NGFWs), to
analyze traffic patterns and generate timely reports on SMB resources.
● Use highly secure monitoring systems like global threat sensors for extremely sensitive and
classified information.
● Employ digitally signed data transmission and communications for accessing SMB
resources.
● Block or disable TCP ports 88, 139, and 445 and UDP ports 88, 137, and 138 to avert SMB-
related attacks.
● Activate public profile settings in the firewall configuration.
● Block or disable the SMB protocol on servers that face the Internet.
● Ensure that SMB convention web-facing and DNS servers are turned off.
● Confirm that all systems utilize SMBv3 or later, which includes improved security features
like encryption. Avoid employing SMBv1, as it is obsolete and poses security risks.
● Set up ACLs to limit access to SMB shares solely to necessary users and routinely review and
tighten these permissions.
● Apply the least privilege principle to ensure that users and services function with the
minimum required permissions, thereby reducing the potential fallout from compromised
accounts.
● Configure SMB servers to log access attempts and modifications to shared resources and
regularly examine logs for any unusual activity.
Module 04: Enumeration
● Activate DNS Logging and Monitoring: Enable logging on DNS servers to capture queries
and responses. Regularly monitoring and analyzing these logs can help identify suspicious
activity that may indicate enumeration attempts.
● Utilize Anomaly Detection: Implement anomaly detection systems to automatically
highlight unusual DNS query volumes or patterns, which may signify enumeration or other
DNS attacks.
● Apply Rate Limiting: Set up DNS servers to restrict the rate of accepted queries from
individual IP addresses to diminish the impact of brute-force enumeration techniques.
● Design a Split DNS Architecture: Create a split DNS architecture that manages internal
DNS queries on a separate DNS server from those originating externally, limiting the
exposure of internal network configurations.
● Share Minimal DNS Information: Exercise caution regarding the amount of information
disclosed through DNS records. For example, avoid using detailed subdomain names that
could expose internal network information or server functions.
Other measures to protect against DNS enumeration include:
● Ensure that private hosts and their associated IP addresses are not included in the public
DNS server's zone files.
● Use standard network administrator contacts for DNS registrations to prevent social
engineering threats.
● Simplify DNS zone files to prevent the disclosure of unnecessary information.
● Maintain distinct internal and external DNS servers.
● Regularly remove old or unused DNS records.
● Restrict [Link] request queries using Access Control Lists (ACLs), and run BIND with
minimal privileges.
● Utilize the /etc/hosts file for developing or staging subdomains instead of relying on DNS
records.
● Implement DNS Firewalls to block harmful queries and protect against DNS-based threats
by leveraging threat intelligence to identify and prevent communication with known
malicious domains.
● Consistently review and audit DNS configurations to confirm their security and that only
essential DNS information is made public.
Summary
Enumeration is the process of actively gathering detailed information about a target system or
network, typically used by attackers to identify vulnerabilities for exploitation. It involves probing
systems to collect data such as user accounts, network shares, and configurations, which can then
assist in planning further attacks.
The chapter covers key enumeration techniques, starting with an introduction to the concept.
Unlike passive reconnaissance, enumeration actively interacts with services like NetBIOS, SNMP,
Module 04: Enumeration
and LDAP to reveal valuable system details. Techniques like NetBIOS enumeration are used to
identify network shares, users, and services, while SNMP enumeration targets devices to extract
configurations that may reveal sensitive data. LDAP enumeration focuses on extracting directory
information about users and resources, especially in Windows Active Directory environments.
Other methods include NTP and NFS enumeration, which reveal server details and network file
shares. SMTP and DNS enumeration help attackers collect email addresses, mail routing
information, and DNS records that aid in phishing or domain spoofing attacks. Additional
enumeration techniques include SMB, RPC, and HTTP, each targeting specific services for further
exploitation. To defend against these techniques, countermeasures like disabling unnecessary
services, implementing strong access controls, securing protocols (e.g., using SNMPv3), and
monitoring network traffic are recommended to prevent unauthorized enumeration attempts.
Module 04: Enumeration
Mind Map
Practice Questions
3. In NetBIOS enumeration, which tool is commonly used to query NetBIOS name tables?
A. Nessus
B. nbtscan
C. Metasploit
D. Wireshark
4. Which command can retrieve a list of time servers during NTP enumeration?
A. ntpq -p
B. snmpget
C. ldapsearch
D. dig -x
5. During SNMP enumeration, the most commonly used community strings are __________ and
_________.
A. public, private
B. admin, root
C. manager, user
D. guest, test
7. NetBIOS enumeration allows attackers to identify shared folders and printers on a network.
A. True
B. False
10. DNS enumeration using the dig command is primarily performed to discover:
A. Subdomains and mail servers
B. Active user accounts
C. SNMP community strings
D. Shared network drives
12. The Simple Network Management Protocol (SNMP) uses encryption to secure transmitted
data by default.
A. True
B. False
14. Using countermeasures like disabling unused protocols can reduce the risk of enumeration.
A. True
B. False
16. DNS zone transfers can provide attackers with a list of all DNS records in a domain.
A. True
B. False
17. Which command is used to list shared directories on a target system during NetBIOS
enumeration?
A. net use
B. nbtstat -A <IP>
Module 04: Enumeration
C. showmount
D. ldapsearch -x
19. The command _________ can be used to query DNS servers for Name Server (NS) records.
A. nslookup
B. rpcclient
C. ldapsearch
D. snmpget
20. The snmpwalk tool can be used to automate bulk requests in SNMP enumeration.
A. True
B. False
21. What is the primary protocol used for VoIP signaling during enumeration?
A. HTTP
B. RTP
C. SIP
D. FTP
22. Which enumeration technique involves querying port 25 for user information?
A. SNMP enumeration
B. NetBIOS enumeration
C. SMTP enumeration
D. LDAP enumeration
24. SNMP enumeration relies on ___________, which act as simple passwords for accessing
device information.
A. community strings
B. certificates
C. encryption keys
D. access tokens
25. Which of the following tools can be used to identify open RPC services on a target system?
A. Nessus
B. Nmap
Module 04: Enumeration
C. Nikto
D. Burp Suite
Module 04: Enumeration
Answers
1. Answer: C
Explanation: SNMP (Simple Network Management Protocol) typically operates over UDP port
161 to query and manage network devices like routers, switches, and servers. It is used for
monitoring and collecting information about network health and performance, making it a key
target for enumeration efforts.
2. Answer: B
Explanation: Lightweight Directory Access Protocol (LDAP) is designed to access and manage
directory services over a network. These services offer a centralized location to store and retrieve
information about users, groups, devices, and other network resources.
3. Answer: B
Explanation: nbtscan is a tool specifically designed to perform NetBIOS enumeration. It queries
NetBIOS name tables to gather information about hostnames, workgroups, and shared resources
on Windows-based systems, leveraging the NetBIOS protocol.
4. Answer: A
Explanation: The ntpq -p command queries an NTP server and displays a list of its peers (time
servers) along with their synchronization status. This information is useful during NTP
enumeration to identify time synchronization vulnerabilities or other related configuration
details.
5. Answer: A
Explanation: In SNMP, community strings act as passwords for accessing and managing
network devices. The default strings "public" (read-only access) and "private" (read-write access)
are widely used but often remain unchanged, making them a common target during
enumeration.
6. Answer: D
Explanation: ldapsearch is a command-line utility used for querying and interacting with LDAP
directories. It allows the enumeration of directory contents such as users, groups, and
organizational units, making it a widely used tool for LDAP enumeration.
7. Answer: A
Explanation: NetBIOS enumeration can reveal shared resources like folders and printers in
Windows networks by querying NetBIOS name services. Attackers can exploit this information
to map the network and potentially gain unauthorized access to shared resources.
8. Answer: B
Explanation: LDAP typically uses port 389 for communication. It is used for querying and
managing directory services, such as accessing information about users, groups, and devices in a
networked environment.
9. Answer: C
Explanation: NetBIOS operates over ports 135, 137, and 139, each with distinct roles. Port 135 is
used for NetBIOS Name Service (NBNS) and RPC, enabling network communication. Port 137
Module 04: Enumeration
resolves NetBIOS names to IP addresses, helping devices locate each other. Port 139 is for
NetBIOS Session Service, supporting file and printer sharing over TCP/IP networks in Windows
environments.
10. Answer: A
Explanation: The dig command is commonly used for DNS enumeration, allowing the discovery
of various DNS records, such as subdomains and mail servers (MX records). This information is
helpful for attackers to map a target's domain structure and identify potential points of
exploitation.
11. Answer: A
Explanation: During NFS enumeration, the showmount command is used to display the
exported file systems on an NFS server. It reveals which directories are shared over the network
and may be accessible to clients, which is valuable information during penetration testing and
security assessments.
12. Answer: B
Explanation: By default, SNMP does not use encryption to secure transmitted data. SNMPv1
and SNMPv2c send data in clear text, making it vulnerable to interception. However, SNMPv3
supports encryption and provides additional security features like authentication and data
integrity.
13. Answer: A
Explanation: The AXFR request in DNS enumeration is used to perform a zone transfer, which
allows an attacker to request a full copy of a domain's DNS records from a DNS server. This can
reveal valuable information about the domain, such as subdomains, mail servers, and other
associated resources.
14. Answer: A
Explanation: Disabling unused protocols is an effective countermeasure to reduce the risk of
enumeration. By turning off unnecessary services and protocols, such as NetBIOS, SNMP, or
LDAP, organizations can limit the amount of information available to attackers, making it more
difficult for them to gather details about the network or system.
15. Answer: B
Explanation: The NFS export list provides information about the shared file systems that are
accessible to clients. It reveals which directories on an NFS server are being exported for remote
access and can be queried using tools like showmount.
16. Answer: A
Explanation: DNS zone transfers (using the AXFR request) can provide attackers with a
complete list of all DNS records in a domain, including subdomains, mail servers, and other
resource records.
17. Answer: B
Explanation: The nbtstat -A <IP> command is used to query the NetBIOS name table of a
remote computer specified by its IP address. This will display information about shared
resources, including shared directories and printers.
Module 04: Enumeration
18. Answer: B
Explanation: The EXPN command in SMTP is used to expand mailing lists, revealing the
members of a distribution list. This can be valuable for attackers during enumeration, as it
exposes additional email addresses within an organization.
19. Answer: A
Explanation: The nslookup command is used to query DNS servers for several types of DNS
records, including Name Server (NS) records. These records indicate which servers are
authoritative for a domain, helping identify the infrastructure responsible for handling DNS
queries for that domain.
20. Answer: A
Explanation: The snmpwalk tool is used to automate bulk requests during SNMP enumeration.
It queries an SNMP-enabled device for a large set of data by walking through the SNMP
Management Information Base (MIB), retrieving all available information for specified Object
Identifiers (OIDs).
21. Answer: C
Explanation: The primary protocol used for VoIP signaling during enumeration is Session
Initiation Protocol (SIP). SIP is responsible for setting up, managing, and dismissing voice and
video calls over IP networks.
22. Answer: C
Explanation: SMTP enumeration involves querying port 25 (the default SMTP port) for user
information. Tools and techniques like the VRFY and EXPN commands can be used to verify and
expand email addresses, respectively, allowing attackers to gather valid email addresses from the
target system.
23. Answer: A
Explanation: Enumeration countermeasures involve disabling unnecessary services like
NetBIOS and NFS to reduce the attack surface. These services, if left enabled, can expose sensitive
information about the network, shared resources, and system configurations, making them
targets for attackers.
24. Answer: A
Explanation: SNMP enumeration relies on community strings, which act as simple passwords
for accessing device information. These strings, typically default values like "public" (read-only)
and "private" (read-write), allow SNMP clients to query network devices and retrieve data, such
as device configurations and statistics.
25. Answer: B
Explanation: Nmap is a widely used network scanning tool that can identify open ports and
services, including RPC services, on a target system. By scanning port 135 (the default RPC port),
Nmap can help detect active RPC services and their versions, providing valuable information
during enumeration.