|
Thomas Glaser October 25, 2000 IntroductionReconnaissance is a practice used by skilled hackers to size up and gather information about their target. There are several ways to go about gathering any given piece of information regarding a target that would yield vulnerability. One of the most important pieces of information that a hacker could have is the flavor and version operating system of a remote host. With information in regards to the flavor and version of the operating system, a hacker could look for any number of possible vulnerabilities via information on the web that are specific to that operating system and version. For instance, if someone were to determine that an organization’s router to the Internet was running Cisco IOS v11.x, that person could lookup a number of known vulnerabilities at a web site like http://www.securityfocus.com/ that are relevant to IOS v11.x. One such vulnerability that affects IOS v11.x is a denial of service type attack if the router is running a web server. A packet could be crafted such that it would pass the contents: http://<router-ip>/%% to the server port with a spoofed source address that would cause the router to crash. Since the source address was spoofed, it would be extremely difficult if not impossible to track down the perpetrator. The proliferation of several new tools have been made available on the Internet that to a high degree of accuracy can tell the operating system of a host just by examining subtle details in the way the TCP/IP stack was implemented within that operating system. This method is called TCP/IP fingerprinting. Examples of these tools include nmap and queso. This paper examines the specific methodology used by probably the most popular tool for TCP/IP fingerprinting, nmap. TCP/IP Fingerprinting via NMAPSince each developer of an operating system implements TCP/IP a bit differently than another developer of an operating system, different operating system’s TCP/IP stack could respond differently given the same situation in a TCP/IP conversation. At the time of this writing, NMAP interrogates the target machine’s TCP/IP stack by sending it eight different packets and observing the response. Each of the eight different packets are specially crafted to put the target machine in a position where there is a high probability that two things will happen: The target operating system’s TCP/IP stack will respond unique in comparison to another operating system’s TCP/IP stack. The target operating system TCP/IP stack will respond in a consistent manner. Knowing how a given operating system’s TCP/IP stack would respond in advance to each of the eight tests allows NMAP to determine with a high degree of accuracy not only which operating system the target is running, but also what version it is running as well. The crafted test packets are sent one at a time by the source machine running nmap. The tests are documented in the table below:
Several different metrics are observed for each of the first seven tests to help determine the target operating system. They are:
NMAP holds all of its known operating system fingerprints in a text file called nmap-os-fingerprints. There are a few hundred fingerprints documented that include at least one entry for all the popular operating systems. An entry in the file typically looks like: Fingerprint Windows 2000 The line that states Fingerprint Windows 2000 identifies the operating system (and sometimes version) that owns the fingerprint. The next line that begins with TSeq, identifies the method for calculating TCP sequence numbers for a given TCP session. The lines that follow, starting with T1 through PU, are descriptive of how that operating system fingerprinted would respond to the given test. The tests T1 through T7 are all TCP tests. The symbol ‘%’ delimits the metrics used in fingerprinting. The symbol ‘|’ is used to represent "or" in a given set of answers to a metric to state that a number of given results would satisfy the fingerprint. The metrics are detailed in the following table:
For example, let us take the first test in the previous fingerprint example: T1(DF=Y%W=402E%ACK=S++%Flags=AS%Ops=MNWNNT) This test states that the response packet of the target host to NMAP sending a SYN packet with options to it had the following characteristics:
The following is a trace (using dump) that illustrates how the tests are implemented. There is a source machine running NMAP (10.0.2.3) and a target machine (10.0.2.6) that we would like to test to see if NMAP can find a TCP/IP stack fingerprint for in its fingerprint file.
The first test packet NMAP sends out is a SYN packet some TCP options set. Looking at the above trace and going through our metrics we can deduce the following:
T1(DF=Y%W=402E%Ack=S++%Flags=AS%Ops=MNWNNT)
The second test packet NMAP sends out is a NULL packet some TCP options set. Looking at the above trace and going through our metrics we can deduce the following:
T2(Resp=Y%DF=N%W=0%ACK=S%Flags=AR%Ops=)
The third test packet NMAP sends out is a SYN/FIN/PSH/URG packet some TCP options set to a known open port. The fingerprint for T3 would look like: T3(Resp=Y%DF=Y%W=402E%ACK=S++%Flags=AS%Ops=MNWNNT)
The fourth test packet NMAP sends out is an ACK packet some TCP options set to a known open port. The fingerprint for T4 would look like: T4(DF=N%W=0%ACK=O%Flags=R%Ops=)
The fifth test packet NMAP sends out is an SYN packet some TCP options set to a known closed port. The fingerprint for T5 would look like: T5(DF=N%W=0%ACK=S++%Flags=AR%Ops=)
The sixth test packet NMAP sends out is an ACK packet some TCP options set to a known closed port. The fingerprint for T6 would look like: T6(DF=N%W=0%ACK=O%Flags=R%Ops=)
The seventh test packet NMAP sends out is an FIN/PSH/URG packet some TCP options set to a known closed port. The fingerprint for T7 would look like: T7(DF=N%W=0%ACK=S++%Flags=AR%Ops=) Adding up the results of the cumulative testing results in the examples shows a fingerprint that matches the fingerprint shown for Windows 2000 above. Countermeasures to TCP/IP Fingerprinting?There has been a little bit of talk on the Internet regarding possible counter measures to stack fingerprinting. The two main solutions that come up most often:
The fact of the matter is that most of these fixes are stopgap measures and not very extensible. The proper fix is standards compliance and ubiquitous support. Of course the question then becomes which standards do we adhere to, and what is to be done if there isn't standard defined behavior for some instance...? That's a good one. I say, close the Internet for repairs.As route suggested, the true fix is "standards compliance and ubiquitous support" that he and another colleague suggested is near impossible: You probably can't, at least without a significant, tedious, and error-prone code audit. We've been doing research on OS fingerprinting for the past few years, and there are hundreds of different stack-specific idiosyncrasies. http://www.securityfocus.com/archive/1/12675 Thomas H. Ptacek Feb 22 1999 References[1] Fyodor. "Remote OS detection via TCP/IP Stack FingerPrinting." October 18, 1998. http://www.insecure.org/nmap/nmap-fingerprinting-article.html [2] Various. "nmap-os-fingerprints." October 12, 2000. Included with NMAP tool. [3] Gilbert, Patrick. "PREVENTING REMOTE OS DETECTION." http://www.pgci.ca/fingerprint.html (October 12, 2000) [4] Ptacek, Thomas. "BugTraq Article: Re: Preventing remote OS detection." February 22, 1999. http://www.securityfocus.com/archive/1/12663 (October 24, 2000) [5] route. "BugTraq Article: Re: Preventing remote OS detection." February 22, 1999. http://www.securityfocus.com/archive/1/12670 (October 24, 2000) [6] Information Sciences Institute. "RFC793." September 1981. ftp://ftp.cis.ufl.edu/pub/ietf/rfc/rfc793.txt [7] Microsoft Corporation. "Description of Windows 2000 TCP Features." December 29, 1999. http://support.microsoft.com/support/kb/articles/Q224/8/29.ASP (October 24, 2000) [8] Hall, Eric. "Advanced TCP Options." February 8, 1999. http://www.networkcomputing.com/1003/1003ws1.html |