- Nmap Network Scanning
- Chapter 8. Remote OS Detection
Chapter 8. Remote OS Detection
- Introduction
- Usage and Examples
- TCP/IP Fingerprinting Methods Supported by Nmap
- Probes Sent
- Response Tests
- TCP ISN greatest common divisor (
GCD
) - TCP ISN counter rate (
ISR
) - TCP ISN sequence predictability index (
SP
) - IP ID sequence generation algorithm (
TI
,CI
,II
) - Shared IP ID sequence Boolean (
SS
) - TCP timestamp option algorithm (
TS
) - TCP options (
O
,O1–O6
) - TCP initial window size (
W
,W1
–W6
) - Responsiveness (
R
) - IP don't fragment bit (
DF
) - Don't fragment (ICMP) (
DFI
) - IP initial time-to-live (
T
) - IP initial time-to-live guess (
TG
) - Explicit congestion notification (
CC
) - TCP miscellaneous quirks (
Q
) - TCP sequence number (
S
) - TCP acknowledgment number (
A
) - TCP flags (
F
) - TCP RST data checksum (
RD
) - IP total length (
IPL
) - Unused port unreachable field nonzero (
UN
) - Returned probe IP total length value (
RIPL
) - Returned probe IP ID value (
RID
) - Integrity of returned probe IP checksum value (
RIPCK
) - Integrity of returned probe UDP checksum (
RUCK
) - Integrity of returned UDP data (
RUD
) - ICMP response code (
CD
)
- TCP ISN greatest common divisor (
- IPv6 fingerprinting
- Fingerprinting Methods Avoided by Nmap
- Understanding an Nmap Fingerprint
- Device Types
- OS Matching Algorithms
- Dealing with Misidentified and Unidentified Hosts
- SOLUTION: Detect Rogue Wireless Access Points on an Enterprise Network
Introduction
When exploring a network for security auditing orinventory/administration, you usually want to know more thanthe bare IP addresses of identified machines. Your reaction todiscovering a printer may be very different than to finding a router,wireless access point, telephone PBX, game console, Windows desktop,or Unix server. Finer grained detection (such as distinguishing MacOS X 10.4 from 10.3) is useful for determining vulnerability tospecific flaws and for tailoring effective exploits for thosevulnerabilities.
In part due to its value to attackers, many systems aretight-lipped about their exact nature and operating systemconfiguration. Fortunately, Nmap includes a huge database ofheuristics for identifying thousands of different systems based on howthey respond to a selection of TCP/IP probes. Another system (part ofversion detection) interrogates open TCP or UDP ports to determinedevice type and OS details. Results of these two systems are reportedindependently so that you can identify combinations such as aCheckpoint firewall forwarding port 80 to a Windows IIS server.
While Nmap has supported OS detection since 1998, this chapterdescribes the 2nd generation system released in 2006.
While some benefits of discovering the underlying OS and device types on a network are obvious, others are more obscure. This section lists the top reasons I hear for discovering this extra information.
Determining vulnerability of target hosts
It is sometimes very difficult to determine remotely whether anavailable service is susceptible or patched for a certainvulnerability. Even obtaining the application version number doesn'talways help, since OS distributors often back-port security fixeswithout changing the version number. The surest way to verify that avulnerability is real is to exploit it, but that risks crashing theservice and can lead to wasted hours or even days of frustratingexploitation efforts if the service turns out to be patched.
OS detection can help reduce these false positives. Forexample, the Rwho daemon on unpatched Sun Solaris 7 through 9 may beremotely exploitable (Sun alert #57659). Remotely determiningvulnerability is difficult, but you can rule it out by finding that atarget system is running Solaris 10.
Taking this from the perspective of a systems administratorrather than a pen-tester, imagine you run a large Sun shop when alert#57659 comes out. Scan your whole network with OS detection to findmachines which need patching before the bad guys do.
Tailoring exploits
Even after you discover a vulnerability in a target system, OSdetection can be helpful in exploiting it. Buffer overflows,format-string exploits, and many other vulnerabilities often requirecustom-tailored shellcode with offsets and assembly payloads generatedto match the target OS and hardware architecture. In some cases, youonly get one try because the service crashes if you get theshellcode wrong. Use OS detection first or you may end up sendingLinux shellcode to a FreeBSD server.
Network inventory and support
While it isn't as exciting as busting root through a speciallycrafted format string exploit, there are many administrative reasonsto keep track of what is running on your network. Before you renewthat IRIX support contract for another year, scan to see if anyonestill uses such machines. An inventory can also be useful for ITbudgeting and ensuring that all company equipment is accountedfor.
Detecting unauthorized and dangerous devices
With the ubiquity of mobile devices and cheap commoditynetworking equipment, companies are increasingly finding thatemployees are extending their networks in undesirable ways. They mayinstall a $20wireless access point (WAP)in their cubicle withoutrealizing (or caring) that they just opened up the protected corporatenetwork to potential attackers in the parking lot or nearby buildings.WAPs can be so dangerous that Nmap has a special category fordetecting them, as demonstrated inthe section called “SOLUTION: Detect Rogue Wireless Access Points on an Enterprise Network”. Users may also cause sysadmins grief by connecting insecure and/orworm-infected laptops to the corporate network. Regular scanning can detect unauthorizeddevices for investigation and containment.
Social engineering
Another possible use is social engineering. Lets say that youare scanning a target company and Nmap reports a“DatavoiceTxPORT PRISM 3000 T1 CSU/DSU 6.22/2.06”. You could call up thetarget pretending to be Datavoice support and discuss some issues withtheir PRISM 3000. Tell them you are about to announce a big securityhole, but are first providing the patch to valued customers. Somenaive administrators might assume that only an authorized engineerfrom Datavoice would know so much about their CSU/DSU. Of course thepatch you send them is a Trojan horse that gives you remote access tosniff and traipse through their network. Be sure to read the rest ofthis chapter for detection accuracy and verification advice beforetrying this. If you guess the target system wrong and they call thepolice, that will be an embarrassing story to tell yourcellmates.