Disclaimer
Do NOT preform network scans on networks without prior authorization.
Download
Nmap for Windows
Nmap for Linux
Background
This blog post is design to provide one with a basic understanding of how Nmap works and concepts to consider when performing a network scan.
Purpose
Network Scanning is the probing of individual network systems for the purpose of obtaining vital information about it. Packet(s) are sent with various network flags set (SYN, ACK, FIN, URG, PSH) in order to solicit a response from the target system. The different response(s) are known to mean specific things are true.
Requirements
To perform a network scan the system performing the scan must have one of the following IP Address of the network to be scanned, an IP Address CDIR range, or a domain name.
Methodology
Network scanning is a balancing act between probing a system and the amount of time spent probing it. The more time you take probing an individual system for results will increases the likely hood of it crashing. Bandwidth consumption is also a consistent issue which must be monitored, as consuming too much will slow down the network for business operations. Try to limit the amount of bandwidth your scan will use by setting time out limits per system, specifying your options related to protocols and data collection. Scanning multiple systems in parallel will increase the speed of your scan.
Output
The output from Nmap is a list of scanned targets, with supplemental information on each depending on the options used. Key among that information is the “interesting ports table”. That table lists the port number and protocol, service name, and state. The state is either open, filtered, closed, or unfiltered. Open means that an application on the target machine is listening for connections/packets on that port. Filtered means that a firewall, filter, or other network obstacle is blocking the port so that Nmap cannot tell whether it is open or closed. Closed ports have no application listening on them, though they could open up at any time. Ports are classified as unfiltered when they are responsive to Nmap's probes, but Nmap cannot determine whether they are open or closed. Nmap reports the state combinations open|filtered and closed|filtered when it cannot determine which of the two states describe a port. The port table may also include software version details when version detection has been requested. [2]
How To
Syntax:
nmap [option] [option]... Domain/IP Address
List of Nmap Options
Common Issues
Firewalls and Systems can be configured to drop or not respond to the various network flags based on various criteria. [1]
Common Solutions
Evade Firewalls:
- Don't Ping
- Skip the default discovery check.
- Limit the number of SYN packets you send at one time. [1]
Nmap is used for mainly two purposes Asset Management and Vulnerability Scanning.
Vulnerability Scanning
One of the uses of network scanning is for identifying vulnerabilities of individual network systems. This is done through a process called Fingerprinting in which the collection of information relating to an individual system is obtained. It is a best practice to use verbose when using the TCP fingerprinting method as to gather logging information for trouble shooting purposes.Key information from Fingerprinting is (but not limited) to:
- Services running
- Operating systems
- Device type
- OS CPE
- OS details
- Uptime guess
- Network Distance
- TCP Sequence Prediction
- IP ID sequence generation
Is the process of maintaining current information on system inventory. In addition to the physical inventory the capability/usage of the system can also be cataloged. This process is similar to Vulnerability scanning with a change in focus for the resulting information. One may be more focused on an individual system's uptime or services running for the purpose of identifying a systems role in the organization's infrastructure.
For asset management scan I would scan the network in segments and if possible during off business hours. For network segmentation try to determine which systems are internet facing verses internal. For the public facing use options that identify if a system is online. For speed use an option that does not require a response from the probed system. To Identify network segments. To speed up your scan increase the number of parallel operations (host being scanned in parallel to one another).
Nmap Scripting Engine (NSE)
(Disclaimer: I do not recommend using a publicly available NSE without first reviewing the code for yourself to determine its legitimacy.)
Here is Nmap.org's official list of Nmap Scripting Engine from Cyber Security professionals and Amateurs. I recommend reviewing their code to learn how to create your own NSE.
Resources
List of websites available for scanning
Nmap 6 Cookbook: The Fat Free Guide to Network Scanning by Nicholas Marsh
- ISBN-10: 1507781385
- ISBN-13: 978-1507781388
References
1. Nmap 6 Cookbook: The Fat Free Guide to Network Scanning by Nicholas Marsh
- ISBN-10: 1507781385
- ISBN-13: 978-1507781388
- https://nmap.org/book/man.html
Social Media
Facebook:
https://www.facebook.com/BDavisCS/
Twitter:
@BDavis_CyberSec