If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

TCP/IP Fingerprinting via NMAP

TCP/IP Fingerprinting via NMAP
Since 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:

Test Description
TSeq A series of SYN packets are sent to the target machine to see how TCP sequence numbers are derived.

T1 A SYN packet with options (WNMTE) set is sent to an open TCP port.
T2 A NULL packet with options (WNMTE) set is sent to an open TCP port.
T3 A SYN,FIN,PSH,URG packet with options (WNMTE) set is sent to an open TCP port.
T4 An ACK packet with options (WNMTE) set is sent to an open TCP port.
T5 A SYN packet with options (WNMTE) set is sent to a closed TCP port.
T6 A ACK packet with options (WNMTE) set is sent to a closed TCP port.
T7 A FIN,PSH,URG packet with options (WNMTE) set is sent to a closed TCP port.
PU A packet to a closed UDP port.

Several different metrics are observed for each of the first seven tests to help determine the target operating system. They are:

Whether or not the target host responded.

Whether or not the target host responded with a packet that had the "Donít Fragment" bit set.

The Window Size set by the target host in the response packet.

The relationship of the acknowledgement number of the TCP packet sent in response to NMAPís prior TCP packet.

Flags set in the TCP packet sent in response.

TCP options that are in the responding packet.

The first test (Tseq) and last test (PU) uses different metrics that will not be covered in this paper, but the same principles apply.

All of these metrics can measure something different between operating systems and different versions of the same operating system given a certain test. But these metrics are consistent with the same version of a given operating system given any of the tests that NMAP implements.

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:

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:

Metric Valid Values Description
Resp (Whether or not the host responded to the test packet by sending a reply. )
Y = There was a response
N = There was no response

DF (Whether or not the host responding to the test packet sent the "Donít Fragment" bit in response. )
Y = DF was set
N = DF was not set

W (Can be a two-byte integer expressed in hexadecimal. Window advertisement size sent by the host responding to the test packet. )

Ops (Options sent back by the host responding to the test packet. There can be any number of options set (including none) in any order.)
M = MSS
E = Echoed MSS
W = Window Scale
T = Timestamp
N = No Option

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:

Resp= Resp is not defined; which means the metric is satisfied whether or not the target replies

DF=Y The "Donít Fragment" bit was set

W=402E The window size was 402E

ACK=S++ Acknowledgement number was one plus the initial sequence number

Flags=AS The packet had the SYN/ACK flags set

Ops=MNWNNT The packet had the following option flags set in this order: MNWNNT

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.

Sorry everyone. I didn't realize that we were trying to take credit for anything we posted here. I wasn't writing a paper for college or submitting this as simething of my own for work etc. Next time I'll post a link instead, or put the author's name on it. My bad.