Advanced NMap
Advanced NMap
Submit Tips
Search
HOME
REVIEWS
HOW-TOS
CODING
INTERVIEWS
FEATURES
OVERVIEW
BLOGS
SERIES
IT ADMIN
Search for:
Search
A broad overview and the basic features of NMap have been covered in an earlier article in this series of articles on Nmap. In this article, we discuss in detail various NMap scan types, and the practical use of these commands to scan various devices and networks.
Before we begin understanding NMap scan types, let us start with the basics, including understanding the 3-way TCP handshake. TCP/IP is not a single protocol, but a suite comprising various protocols, some of which are detailed in Table 1. Table 1: Various TCP/IP protocols 1. 2. 3. 4. Application layer Transport layer Network layer Data link layer FTP, HTTP, SNMP, BOOTP, DHCP TCP, UDP, ICMP, IGMP ARP, IP, RARP SLIP, PPP
3. The client again sends an ACK, followed by Y+1, thus completing the handshake. Now the client and server can start data transfer. After the data transfer is complete, a FIN (Finish) packet is sent by the client, to end the connection. Nmap uses/tweaks this handshake very effectively for various scan types. Before we proceed, let us be clear about two basic but important aspects of Nmap scans: 1. By default, Nmap scans 1,000 most common ports for each protocol. The list of these ports can be modified in the n m a p s e r v i c e sfile, typically stored in / e t c / s e r v i c e s . (I have never used this; the default ports are almost always sufficient! 2. Root privileges are required to run any scan that modifies the standard TCP handshake. Now, let us try to understand the detailed workings of various NMap scan types.
Find us on Facebook
Follow
+2,513
If the device responds with a SYN-ACK, Nmap sends an RST instead of an ACK, resetting the session, rather than completing the handshake for data transfer. If ACK was sent instead of RST, the connection would be left open till session time-out, making the device prone to a denial of service type of situation. To run a SYN scan, root privileges are required under Linux. A SYN scan is used to find the status of TCP ports on various devices on the network. Since the SYN scan works on TCP, it will work across all operating systems and other devices that implement TCP, such as controllers, PLCs, network printers, Ethernet switches, and mobile phones. Since it does not open a valid TCP connection, its quiet, and difficult to detect. However, careful network monitoring will reveal too many RST frames in traffic, due to one RST frame per scanned port. Heres a sample SYN scan that will return various open TCP ports:
n m a ps S1 9 2 . 1 6 8 . 1 0 0 . 1 0 0
The ping scan uses only one packet for the request, and may get one packet in response, thus making it the fastest of all Nmap scan types, with the lowest footprint. The ping scan cannot be combined with other scan types.
1. Open port: Data on the scanned UDP port. 2. Closed port: ICMP error message indicating no service is running on this port. 3. Open/Filtered port: No ICMP message; Nmap waits for the timeout, and cant determine whether the port is open, or filtered by a firewall. UDP can be used to detect malware/spyware effectively. The following sample UDP scan command will return open/closed/open/filtered UDP ports on the host:
n m a ps U1 9 2 . 1 6 8 . 1 0 0 . 1 0 0
Table 3: Summary of SYN, ping and UDP scans Scan type SYN scan (s S ) Scan TCP ports Facets Does not leave a log entry Requires root access. Traffic of RST frames increases with use of SYN scan. Gives information about TCP ports. Ping scan (s P ) Identify active hosts Very difficult to trace only two standard ICMP frames, which are very common in network traffic, are required to complete the scan. Root privilege not required to run the scan. Yields a device inventory by identifying active devices on the network. UDP scan (s U ) Scan UDP ports Uses 0 byte UDP data, causing low overhead on the network. Requires root access. Many operating systems put restrictions on UDP traffic, thus this scan can be very slow if run on devices running those operating systems Works well on Microsoft operating systems, since Microsoft does not restrict UDP port traffic. Best for scanning known UDP ports used by spyware/malware for communication.
Please try out these scanning techniques, hands-on, before further exploring various other scan options provided by NMap. And dont forget to keep a watch on this series for further details!
Related Posts:
Advanced Nmap: Scanning Techniques Continued Advanced Nmap: FIN Scan & OS Detection Advanced Nmap: Scanning Firewalls Continued Advanced Nmap: A Recap Advanced Nmap: Scanning Firewalls
Tags: Advanced Nmap Series, application layer, ARP, connection oriented protocol, connection-less protocol, Ethernet, http, ICMP, IP addresses, LFY November 2010, Microsoft, network scan, Networking, NMap, operating systems, port scan, PPP, Security, snmp, SYN, SYN-ACK, TCP port, TCP/IP, transport layer, UDP, UDP port, unreliable protocol
Previous Post
Next Post
Get Started with Turnkey Linux -- When and Where it Makes Sense
Share
ICMP & IGMP are the protocols of Network layer. In table table 1 you listed wrong,..!!!
Reply Share
C o m m e n t fe e d
Su b s cri b e vi a e m a i l
Reviews
How-Tos
Coding
Interviews
Features
Overview
Blogs
Search
Popular tags
Linux , ubuntu, Java, MySQL, Google, python, Fedora, Android, PHP, C, html, w eb applications , India, Microsoft, unix , Window s , Red Hat, Oracle, Security , Apache, xml, LFY April 2012, FOSS, GNOME, http, JavaScript, LFY June 2011, open source, RAM, operating systems
All published articles are released under Creative Commons Attribution-NonCommercial 3.0 Unported License, unless otherw ise noted. LINUX For You is pow ered by WordPress, w hich gladly sits on top of a CentOS-based LEMP stack.