Host Identification by Packet Inspection
To determine an endpoint’s operating system one must first understand how to measure differences in a network protocol stack. Start by studying the TCP state machine, understanding how TCP connections are made, where implementations may vary, and creating a series of tests to expose those variances.
To initiate and manage TCP connections endpoints (hosts) exchange packets with certain flags, or control bits, set. There are eight flags available; to identify a host operating system we are interested with the following three:
- ACK – Indicates that the acknowledgment field is significant
- RST – Resets the connection
- SYN – Synchronizes sequence numbers
Transmission Control Protocol is defined in RFC 793 and uses a 3-way handshake protocol to initialize new connections between hosts.

The packet sequence is:
- Caller sends SYN
- Recipient responds with SYN, ACK
- Caller sends ACK
If the connection cannot be made the recipient will typically respond with a RST packet to abort the connection instead of the SYN + ACK to establish it. A successful 3-way handshake is illustrated in the host packet exchange shown below. The process of establishing a connection can be traced on the TCP state diagram below right as (CLOSED) > (SYN_SENT) > (ESTABLISHED) while a failed connection would be (CLOSED > (SYN_SENT) > (CLOSED).

To detect a TCP connection and determine between caller and recipient one must capture only two packets with the SYN (Step 1) and SYN+ACK (Step 2) or RST bits set. To do this note the structure of a TCP packet header and build a packet filter expression.

A TCP header typically holds 20 octets of data. The first line of the packet header contains 32 bits or 4 octets numbered 0 – 3, the second line octets 4 – 7, etc. The TCP control bits are contained in octet 13. In a TCP datagram with the SYN bit set octet 13 resembles the TCP Flags detail illustrated above. By filtering on TCP flags one may capture all packets necessary to profile a host operating system.
References
The standard Ubuntu & Debian VNCServer package does not run out-of-the-box due to a missing font dependency. Inspecting the log file, you see the error message: