0% found this document useful (0 votes)
9 views15 pages

Nmap Scanning Techniques Overview

nmap research paper

Uploaded by

sadosov992
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views15 pages

Nmap Scanning Techniques Overview

nmap research paper

Uploaded by

sadosov992
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Nmap Scanning - Getting Started

By Anmol K Sachan
Nmap​ is the most popular scanning tool used on the Internet, created by Gordon Lyon(Fyodar)
([Link] , it was featured in the Matrix Reloaded movie.

Nmap​ Free Security Scanner, Port Scanner, & Network Exploration Tool is an open source
software for Linux, Windows, UNIX, FreeBSD, etc.

Zenmap​ is GUI version for nmap.

Written in: C, C++, Python, Lua

Refer to help or manual in unix/linux for reading more.


# man nmap

----------------------------------------------------------------------------------------------------------------------------

Standard ​TCP communications​ are controlled by flags in the TCP packet header.

The flags are as follows:

Synchronize - also called "SYN”


Used to initiate a connection between hosts.

Acknowledgement - also called "ACK”


Used in establishing a connection between hosts

Push - "PSH”
Instructs receiving system to send all buffered data immediately

Urgent - "URG”
States that the data contained in the packet should be processed immediately

Finish - also called "FIN"


Tells remote system that there will be no more transmissions

Reset - also called "RST”


Also used to reset a connection.

--------------------------------------------------------------------------------------------------------------------

SYN Scanning​:
Syn scanning, a technique that is widely across the Internet today.
The syn scan, also called the "half open" scan, is the ability to determine a ports state without
making a full connection to the host.
Many systems do not log the attempt, and discard it as a communications error.
You must first learn 3-way handshake to understand the Syn scan.

How ​3-way handshake​ works?

[Link]:2342 ------------syn-----------> [Link]:80

[Link]:2342 <---------syn/ack---------- [Link]:80

[Link]:2342 -------------ack-----------> [Link]:80

Connection Established

--------------------------------------------------------------------------------------------------------

Stealth Scan

Computer A Computer B

[Link]:2342 ------------syn-----------> [Link]:80

[Link]:2342 <---------syn/ack---------- [Link]:80

[Link]:2342 -------------RST-----------> [Link]:80

--------------------------------------------------------------------------------------------------------

Xmas Scan

Xmas scan directed at open port:

Computer A Computer B

[Link]:4031 -----------FIN/URG/PSH----------->[Link]:23

[Link]:4031 <----------NO RESPONSE------------[Link]:23

Xmas scan directed at closed port:

[Link]:4031 -----------FIN/URG/PSH----------->[Link]:23

[Link]:4031<-------------RST/ACK--------------[Link]:23
XMAS scan only works OS system's TCP/IP implementation is developed according to ​RFC
793​.

--------------------------------------------------------------------------------------------------------
FIN Scan

Computer A Computer B

FIN scan directed at open port:

[Link]:4031 -----------FIN------------------->[Link]:23

[Link]:4031 <----------NO RESPONSE------------[Link]:23

FIN scan directed at closed port:

[Link]:4031 -------------FIN------------------[Link]:23

[Link]:4031<-------------RST/ACK--------------[Link]:23

FIN scan only works OS system's TCP/IP implementation is developed according to RFC 793.

--------------------------------------------------------------------------------------------------------
NULL Scan

Computer A Computer B

NULL scan directed at open port:

[Link]:4031 -----------NO FLAGS SET---------->[Link]:23

[Link]:4031 <----------NO RESPONSE------------[Link]:23

NULL scan directed at closed port:

[Link]:4031 -------------NO FLAGS SET---------[Link]:23

[Link]:4031<-------------RST/ACK--------------[Link]:23

NULL scan only works OS system's TCP/IP implementation is developed according to RFC 793.

--------------------------------------------------------------------------------------------------------
ICMP echo scanning

This isn't really port scanning, since ICMP doesn't have a port abstraction.

But it is sometimes useful to determine what hosts in a network are up by


pinging them all.

nmap -P [Link]/24 [Link]/16

--------------------------------------------------------------------------------------------------------

Scan Options

-sT (TcpConnect)

-sS (SYN scan)

-sF (Fin Scan)

-sX (Xmas Scan)

-sN (Null Scan)

-sP (Ping Scan)

-sU (UDP scans)

-sO (Protocol Scan)

-sI (Idle Scan)

-sA (Ack Scan)

-sW (Window Scan)

-sR (RPC scan)

-sL (List/Dns Scan)


Nmap Port Scan types
Scan using TCP connect
nmap -sT [Link]

Scan using TCP SYN scan (default)


nmap -sS [Link]

Scan UDP ports


nmap -sU -p 123,161,162 [Link]
Scan selected ports - ignore discovery
nmap -Pn -F [Link]

--------------------------------------------------------------------------------------------------------

Ping Detection

-P0 (don’t ping)

-PT (TCP ping)

-PS (SYN ping)

-PI (ICMP ping)

-PB (= PT + PI)

-PP (ICMP timestamp)

-PM (ICMP netmask)

--------------------------------------------------------------------------------------------------------
A quick simple scan on [Link] reveals a little about our target:
Scan a host
nmap [Link]

Scan a single IP
nmap [Link]

Scan a range of IPs


nmap [Link]-120
It scans the whole range of given 20 hosts on the network.
Scan a subnet
nmap [Link]/24
Scan targets from a text file
nmap -iL [Link]

--------------------------------------------------------------------------------------------------------

Nmap Port Selection


Scan a single Port
nmap -p 22 [Link]

Scan a range of ports


nmap -p 1-100 [Link]

Scan 100 most common ports (Fast)


nmap -F [Link]

Scan all 65535 ports


nmap -p- [Link]
-----------------------------------------------------------------------------------------------------------------------

Service and OS Detection


Detect OS and Services
nmap -A [Link]

Standard service detection


nmap -sV [Link]
More aggressive Service Detection
nmap -sV --version-intensity 5 [Link]

Lighter banner grabbing detection


nmap -sV --version-intensity 0 [Link]

---------------------------------------------------------------------------------------------------------------------------

Nmap Output Formats


Save default output to file
nmap -oN [Link] [Link]

Save results as XML


nmap -oX [Link] [Link]
Save results in a format for grep
nmap -oG [Link] [Link]

Save in all formats


nmap -oA outputfile [Link]

----------------------------------------------------------------------------------------------------------------------------

IP Address information
Find Information about IP address
nmap --script=asn-query,whois,ip-geolocation-maxmind [Link]/24
---------------------------------------------------------------------------------------------------------------------------

Detect Heartbleed SSL Vulnerability (CVE-2014-0160)


Heartbleed is a security bug in the OpenSSL cryptography library, which is a widely used
implementation of the Transport Layer Security protocol. It was introduced into the software in
2012 and publicly disclosed in April 2014. Heartbleed may be exploited regardless of whether
the vulnerable OpenSSL instance is running as a TLS server or client.
Reference: [Link]

[Link] -sV -p 443 --script=ssl-heartbleed [Link]

---------------------------------------------------------------------------------------------------------------------------

Zenmap​ is the official Nmap Security Scanner GUI.


It is a multi-platform (Linux, Windows, Mac OS X, BSD, etc.) free and open source application
which aims to make Nmap easy for beginners to use while providing advanced features for
experienced Nmap users.

Source: [Link]/zenmap/

Common questions

Powered by AI

The FIN scan sends a packet with the FIN flag to a targeted port. If the port is open, the system sends no response, whereas a closed port will usually send back an RST/ACK packet. It is effective particularly against systems that adhere to RFC 793 TCP/IP standards. Because many commercial systems are based on this standard, FIN scan can be effectively used to stealthily determine open ports without raising alarms on the target system .

The "-oA" option in Nmap is beneficial for generating comprehensive scan reports as it saves the results in three different formats: normal, XML, and grepable formats. This enables flexibility in how the data is analyzed and utilized. XML is suited for integration with XML-parsing tools, normal is human-readable, and grepable allows efficient text processing and searching. This multi-format output facilitates diverse use-cases including automated processing, reporting, and analysis .

Nmap facilitates service and OS detection through options like "-A" for advanced scan features, including operating system detection, service version detection, and traceroute. The "-sV" option specifically targets service detection by capturing banner information, and it allows adjustment of the intensity with "--version-intensity." These techniques help identify running versions and software on open ports, which can indicate specific vulnerabilities or configurations .

The three-way handshake is fundamental to establishing a TCP connection, involving a SYN, a SYN/ACK, and an ACK exchange between a client and server. In SYN scanning, only the first two steps of this handshake occur before the connection is reset, allowing it to probe open ports without completing the handshake. This provides the scanning system the requisite response to determine if a port is open (SYN/ACK response) without alerting the target system via a completed connection .

The XMAS scan sends packets with FIN, URG, and PSH flags set. For open ports, no response is received, indicating the port is open. For closed ports, an RST/ACK response is returned. It only works on systems developed according to RFC 793 because these systems have a specific TCP/IP stack behavior that adheres to the RFC specifications, interpreting the flags in the manner expected by the scan .

The Heartbleed vulnerability impacts systems using vulnerable versions of OpenSSL, exposing sensitive data from memory that might include private keys, session cookies, and passwords. Nmap can help detect it using the "--script=ssl-heartbleed" in conjunction with "-sV -p 443" which scans the secure connection port for the presence of the Heartbleed bug. This capability allows administrators to quickly identify vulnerable systems and mitigate risks by updating or patching OpenSSL .

The "-Pn" option, when used, tells Nmap not to perform host discovery (i.e., no ping will be sent to determine if hosts are up before scanning them). This option is useful for scanning hosts that do not respond to ping requests or when dealing with networks that filter ICMP packets. This makes the scan assume that all hosts in the specified range are up, reducing the initial discovery phase .

The SYN scan, often referred to as a "half-open" scan, allows for determining a port's state without making a full connection to the host, unlike the TCP Connect scan, which establishes a full connection. This characteristic helps in reducing log entries on the target system because many systems do not log connections that are not fully established, thus increasing stealthiness .

TCP flags dictate the purpose of a TCP packet and influence how a target system processes it. For instance, SYN flags are used to request connection initiation, while FIN indicates an end of data transmission. Techniques like SYN scans use the SYN flag to probe ports without completing a connection, evoking a SYN/ACK or RST response. XMAS scans use combinations of FIN, URG, and PSH flags to confuse systems into revealing open ports based on whether they send an RST/ACK or provide no response. The behavior of receiving these flags influences whether a system logs activity or considers it an error, impacting stealth and effectiveness .

The NULL scan differentiates itself by transmitting packets with no set flags, unlike SYN, FIN, or XMAS scans that utilize specific flag combinations. If the port is open, there will be no response; if closed, it will respond with an RST packet. This method relies on the target system's adherence to TCP/IP specifications under RFC 793, making it effective for systems that implement these standards strictly. Its stealthiness lies in appearing like no legitimate request, potentially bypassing intrusion detection systems not configured to catch such anomalies .

You might also like