CEH Module 4
CEH Module 4
1 Enumeration Concepts
ENUMERATION Enumeration Tools and Techniques
OVERVIEW
The systematic process of querying a target’s servers and services for information
The attacker utilizes information gathered during footprinting / reconnaissance to
know which devices and services to query
We exploit normal server functionality and protocols to gain more information about
our target
A combination of manual and automated testing will give the best results
netcat www.someserver.com 80
TCP 3268 Protocol: LDAP Tools: Same as for LDAP, but a different port
Service: MS Active Directory Comments: The Active Directory Global Catalog maintains a listing for all objects in
Global Catalog Service an entire Active Directory forest.
4.2 SMB AND NetBIOS
SMB
NETBIOS Null User
ENUMERATION Tools
Network Basic Input/Output System
An API and Layer 5 protocol
Allows applications to communicate over a local area network (LAN) with device
specific NetBIOS names
1 - 15 alphanumeric characters (a hidden 16th character describes the name type)
Special characters can only include: - . _ $ (dash, period, underscore, dollar sign)
$ has special meaning (name or share exists but is hidden on the network)
Only the dash is compatible with DNS naming conventions
Used by Microsoft for simple LAN communications, name resolution and file
sharing
Originally used by broadcast-based NetBEUI networking protocol
Microsoft later made it a payload of TCP/IP (NetBIOS over TCP)
TCP 137, 139; UDP 137, 138
Name NetBIOS Type Information Obtained
Code
<host name> <00> Unique Hostname
<domain> <00> Group Domain name
<host name> <03> Unique Messenger service running for that computer
<username> <03> Unique Messenger service running for that individual
logged-in user
<host name> <20> Unique Server service running
<domain> <1D> Group Master browser name for that subnet
<domain> <1B> Unique Domain master browser name, identifies PDC for
domain
Microsoft file and print sharing protocol
Microsoft Workstation Service (client) connects to a remote machine’s Server
Service (server)
Also provides authenticated inter-process communication (IPC) among processes
running on remote computers
A hidden network share, known as IPC share (ipc$), is used on Windows computers
Facilitates communication between processes and remote computers
Originally NetBIOS and SMB worked together:
An SMB client uses the NetBIOS API to send an SMB command to an SMB server
Listens for replies from the SMB server.
An SMB server uses the NetBIOS API to listen for SMB commands from SMB clients
Sends replies to the SMB client
Mapping a drive to the IPC$ process then allows you to enumerate a lot of
information via NetBIOS and SMB
Windows utility
Displays NetBIOS over TCP/IP protocol statistics, NetBIOS name tables for local and
remote computers, and the NetBIOS name cache
nbtstat [-a RemoteName] [-A IPAddress] [-c] [-n] [-r] [-R] [-RR] [-s]
[-S] [Interval]
Has 19 sub commands for enumerating information via NetBIOS
Runs on Linux
Enumerates NetBIOS information from Windows and Linux SAMBA
-A all
-U get userlist
-M get machine list
-N get namelist dump (different from -U and-M)
-S get sharelist
-P get password policy information
-G get group and member list
A connection-based TCP port scanner, pinger, and hostname resolver
Support for unlimited IP ranges
Host detection by multiple ICMP methods
TCP SYN and UDP scanning
Simple HTML report generation
Source port scanning
Hostname resolving
Banner grabbing
Windows host enumeration
NetBIOS Enumerator
NSAuditor Network Security Auditor
Includes more than 45 network tools and utilities for network security auditing, network
scanning, network monitoring, etc.
Hyena
A GUI application for managing and security Microsoft operating systems
Shows shares
User logon name for Windows servers and domain controller
Displays graphical representation of Microsoft Terminal Services, Microsoft Windows
Network, Web Client Network, etc.
Winfingerprint
Shows operating system, enumerates users, groups, SIDs, transports, session, services,
service pack and hotfix level, date and time, disks, and open TCP/UDP ports
4.3 FILE FTP
TRANSFER TFTP
NFS
ENUMERATION
A common, clear text file sharing protocol
Interactive
Has commands to list files and directories, upload and download files
TCP 21 (commands)
TCP 20 or random port (data transfer)
Data
Firewall is on the
client side
The server tries to initiate the data connection, which the client’s firewall blocks
Data
The client initiates the data connection, which the client’s firewall allows
You can use FTP commands to enumerate information from an FTP
server:
Accounts
Passwords
Anonymous login capabilities
Port scanning other targets
Netcat
Banner grab from an FTP server
Nmap scripts
ftp-anon – Checks if an FTP server allows anonymous logins.
ftp-brute – Performs brute-force password auditing against FTP servers.
ftp-bounce – Checks to see if an FTP server allows port scanning using the FTP bounce
method.
ftp-user-enum
Tool for enumerating OS-level user accounts via the ftp service
Works against the default Solaris in.ftpd and GNU inetutils ftpd
FTP’s “Little Brother”
No authentication
Clear text
UDP 69
Non-interactive
No browsing the server directory
You must know the name of the file you want to download / upload
Nmap has a script that will try to download files by supplying a list of file names
nmap -sU -p 69 --script tftp-enum.nse
--script-args tftp-enum.filelist=customlist.txt <host>
You can use the NFS client to enumerate shares on the network
On the file server:
1. Add a line in the /etc/exports file to allow anyone on the subnet to read/write to
the share:
/home/srvshare 192.168.1.0/24(rw,sync)
2. Run a command to export all shares listed in /etc/exports:
exportfs -a
3. Start the NFS server process:
/etc/init.d/nfs-kernel-server start
On the client:
mkdir /home/fromserver
sudo mount -t nfs <server IP>:/home/srvshare /home/fromserver
Overview
4.4 WMI Namespace
ENUMERATION Querying
Tools
The Microsoft implementation of Web-Based Enterprise Management (WBEM)
A standard technology for accessing management information in an enterprise
environment
Uses the Common Information Model (CIM) industry standard to represent systems,
applications, networks, devices, and other managed components
Capable of obtaining management data from remote systems
Uses DCOM (TCP 135) to make these connections
WMI organizes its classes in a hierarchical namespace
Conceptually similar to a folder structure
Get-CimInstance <class> | fl
Output results in list format
WMI Query Language
A subset of ANSI SQL
Basic syntax:
Select <property> from <WMI-class>
Examples:
Select * from Win32_Bios
Select Name from Win32_Bios
Select name, version from Win32_Bios
The manager uses a Management Information Base (MIB) to know what types of
information an agent can provide
A MIB is a set of counters (Object IDs) relevant to the device
SNMP has several versions that are still in use
v1, v2, v2c all communicate in clear text
v3 is encrypted
Not all devices support v3
Both the manager and agent are configured with a simple authentication mechanism called
the “community string”
Simple text string
An agent will only respond to a manager that has the same community string
There are two default community strings:
“Public” – for read-only queries
“Private” – for read/write communications
Many administrators do not change the default community strings
SNMP Ports:
UDP 161 - Manager queries and agent replies
UDP 162 – Agents “raise traps” (send pre-configured alerts) to the manager
Managed Device
Router, switch, hub, firewall, computer, server service (DHCP, DNS, etc.) printer, IoT
device
Agent
Software installed on managed device
Responds to the NMS
Many SNMP management tools include a feature to discover all the MIBs installed on
the agents
You can also “walk” the MIB
Start at a single common OID
Repeatedly ask the device to “get-next” until it runs out of OIDs to report on
Network devices IP and MAC addresses
Hosts ARP tables
Users and groups Routing tables
Services VLANs
Installed software Port and interface status
Network shares Network traffic
Device configurations and much, much more
Solar Winds Engineer’s Toolset OpUtils
Nmap NSE scripts OIDVIEW SNMP MIB Browser
There are 12 for snmp
iReasoning MIB Browser
Metasploit snmp auxiliary
SNScan
modules
SoftPerfect Network Scanner
Snmpwalk
SNMP Informant
Snmpget
Net-SNMP
SNMP Scanner
NSauditor Network Security
Getif
Spiceworks
Observium
Snmpget and snmpwalk
have the same syntax. Both
snmpget Windows and Linux use
Query a single OID these commands.
snmpwalk
Query an entire MIB starting from a particular OID
ENUMERATION Tools
The search and edit protocol for X.500-style directory service databases
TCP 389
Secure LDAP TCP 636
Clear text by default
Can be used to obtain a list of every object in the directory service database including:
User, Group, and Computer accounts
User department and contact information
Group membership
Network resource information
dig Hostname
dig DomaiNameHere
SMTP SMTP
Tools
ENUMERATION
Mail Server
Client Acme.com
ACME client uses SMTP to send email
message to email server for acme.com SMTP
As an attacker, you can use the SMTP commands manually to enumerate valid email
addresses
telnet
netcat
NetScanTool Pro
smtp-user-enum
smtp_user_enum.py
Kali iSMTP
Metasploit auxiliary module smtp_enum
nmap NSE script smtp-enum-users
telnet <email server> 25
vrfy [email protected]
use auxiliary/scanner/smtp/smtp_enum
set rhosts <email server IP>
set rport 25
set USER_FILE /root/Desktop/user.txt
exploit
Verify that [email protected] is a valid email address:
CONNECTION SSH
RPC
ENUMERATION
TCP 23
Used to obtain a command prompt of the remote host
Can also be used to banner grab
telnet <target> <port>
nmap has several telnet enumeration scripts
Run all nmap telnet scripts against a target:
nmap -n -sV -Pn --script "*telnet* and safe" -p 23 <target>
Brute force password via telnet
Nmap –script telnet-brute <target>
TCP 22
Secure replacement for telnet
Client and server exchange public keys to create a session key
Includes Secure FTP (SFTP) and Secure Copy (SCP)
Login syntax = ssh <username>@<hostname>
Nmap, Metasploit and Searchsploit have various tools for SSH enumeration and
exploitation
1. Use nmap to determine if a host is running an SSH service
2. Use nmap to query the version of SSH
3. Use a Metasploit module to enumerate SSH users
4. Check the Kali searchsploit module to see if an enumeration (or other) exploit
exists for the SSH service
5. Search for nmap scripts related to SSH enumeration
Use nmap to determine if a host is running an SSH service
nmap <target>
Run default nmap scripts to query the version of SSH
searchsploit openssh
TCP 135
Used by Windows processes to make requests of each other over the network
rpcinfo
Make a connection to an RPC server and receive information about that server
rpcclient
Enumerate and manage domain and SAM users and SIDs, groups, shares, domain info,
privileges and more
Will attempt to connect via null session
If this is unsuccessful a username and password must be supplied
srvinfo
lookupnames administrator
lookupsids
enumdomusers
4.10 WEBSITE Overview
Methods
ENUMERATION Tools
Usernames and passwords
Email addresses and contact information
Domain names, host names and IP addresses
Links and URLs
Technologies used by the organizations
Employee, customer and other confidential information
Internal resources
Potential vectors for attack
The simplest way to start website enumeration
View the HTML source of a web page
Attempt to open a browser to popular directory names
Note the HTTP response code:
404 = "Not Found“
403 = "Forbidden“
402 = "Payment Required“
401 = "Unauthorized" (Must authenticate first)
200 = "OK“
Using Netcat
echo -en "GET / HTTP/1.0\n\n\n"| nc www.comptia.org 80 | grep Server
Some websites are deliberately configured to use non-standard ports
nmap -sV can detect this
ENUMERATION IPSEC
IPv6
TYPES BGP
Network Time Protocol (NTP) is used to synchronize clocks of network devices
UDP 123
Can maintain time to within 10 milliseconds over the public Internet
Attackers query NTP for
List of hosts connected to NTP server
Clients IP addresses, system names, and operating systems
Internal IP addresses can be acquired if the NTP server is on the DMZ
Active Directory clients use Windows Time (not NTP) to synchronize their clocks to the domain
The Active Directory PDC Emulator domain controller is the time source for the domain.
It can synchronize to other sources via NTP.
Ntpdate
Query a time server
ntpdate -q pool.ntp.org
Ntptrace
Traces a chain of NTP servers back to the primary source
ntptrace
Ntpdc
Monitors operation of the NTP server
This example requests the last 600 clients that connected to the NTP time server:
ntpdc -n –c monlist <IP or hostname of time server>
NTP Time Server Monitor
NTP Server Scanner
Nmap
Wireshark
AtomSync
NTPQuery
PresenTense NTP Auditor
PresenTense Time Server
PersenTense Time Client
NTP Time Server Monitor
LAN Time Analyser
VoIP uses SIP (Session Initiation Protocol) to manage voice and video calls over IP
TCP 5060 - Clear Text
TCP 5061 - SIP-TLS (encrypted)
This information can be used to launch various VoIP attacks such as:
DoS, Session Hijacking, Caller ID spoofing, Eavesdropping, Spamming over Internet
Telephony, VoIP phishing, etc.
Discover target VoIP information through:
Google search and Shodan for public information
Nmap and Sipvicious to map the internal VoIP network
Wireshark to identify SIP users
Job sites that list knowledge of a specific VoIP system as a skills requirement
Attacks include:
SIP flood, RTP flood, SIP enumeration, Digest leak, RTP Bleed and RTP inject, fuzzing
root@kali:~# svmap 192.168.1.0/24 -v
Found 1 domain name, 1 unique ipv4 and 2 unique ipv6 addresses for example.com.
Border Gateway Protocol (BGP) is the routing protocol used on the Internet
ISPs use BGP to choose Internet routes
BGP has slow convergence
An entire Autonomous Systems is treated as a “hop”
whois -a "nintendo*"
MEASURES AND
REVIEW
When possible, use protocols that are encrypted, rather than clear text
Disable NetBIOS and SMBv1
Change the SNMP community string
Disallow DNS zone transfers to unknown servers
Maintain separate DNS servers for internal and public records (split DNS)
Consider disabling VRFY and EXPN commands on your email server
Use file system and share permissions to restrict access to sensitive content
Perform your own enumeration to see what types of information an attacker can obtain
Remediate when possible
INTRO TO
Enumeration is the systematic process of querying a target’s servers and services for
ETHICAL
information
Enumeration should appear to the server as a normal client making legitimate
HACKING
information requests
You can enumerate information about the OS, its services, users and groups, network
REVIEW
information, machine names, configuration settings, installed apps and service
banners