OS Fingerprinting

Using nmap to scan for the operating system type

One of the features nmap is the ability to fingerprint the operating system running on a target host. This can be done with the -O flag, which is the OS detection option of Nmap. Here's an example command:

nmap -O

This will perform a basic scan of all hosts on the network range and attempt to identify the operating system running on each host.

Using the -A flag

If you'd like more detailed information, you can use the -A flag along with -O. Here's an example:

nmap -A -O

This will perform a more aggressive scan to identify the OS, including version detection and script scanning.

Note that OS detection works by examining different network characteristics, including network stack behaviour, initial TCP sequences, and other fingerprints that can indicate the operating system running on a host. These characteristics can sometimes be obscured by network filtering or other security measures, so it is not 100% reliable.

Also, keep in mind that scanning hosts on a network without permission can be illegal in some jurisdictions, so be sure to have the proper authority or permission to perform any scans.

Knowing OS by TTL

TTL (Time To Live) is a value in the header of IP packets that specifies how many more hops a packet can travel before being discarded. The TTL value can help determine the operating system in use on a remote server. In general, different operating systems use different default TTL values for the packets they send out. By comparing the TTL value detected during a Nmap scan to a list of typical TTL values for various operating systems, we can often make an educated guess about the operating system in use.

To get the TTL of a server using Nmap, you can use the -oG flag followed by the output file name and the IP address or hostname of the target. For example:

nmap -oG ttl_output.txt google.com

This command will run a Nmap scan of the target, google.com, and write the output in a Greppable format to a file called ttl_output.txt. To view the TTL value for each port of the target, you can search for "TTL" in the output file:

grep "TTL" ttl_output.txt

This command will display a list of all open ports found during the scan and their associated TTL value.

Note that these values are only typical ranges and may vary depending on network configurations and other factors. It's best to use them as a starting point for fingerprinting remote systems rather than relying on them as definitive proof of the operating system in use.

OS TTLs.pdf
Complete and Continue