Study guide

6.3 OS Fingerprinting, Service Detection & Timing Templates

CREST Practitioner Security Analyst CPSA

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Soft Skills, Legal Framework & Assessment Management

1.1 The Penetration Testing Engagement Lifecycle & Scoping 1.2 Legal Framework: Computer Misuse Act & Compliance 1.3 Understanding, Explaining & Managing Technical Risk 1.4 Record Keeping, Interim Escalation & Reporting Standards

2 Chapter 2: Core Networking: IP Protocols & Network Architectures

2.1 IPv4 and IPv6 Addressing, Subnetting & Header Architecture 2.2 TCP and UDP Transport Protocols & Handshake Mechanics 2.3 ICMP Protocol, Network Diagnostics & Error Messages 2.4 Network Topologies, Switched Media & VLAN Segmentation 2.5 Network Media, Ethernet Standards & Physical Topologies

3 Chapter 3: Cryptography & Secure Communication Protocols

3.1 Symmetric & Asymmetric Cryptographic Algorithms 3.2 Cryptographic Hash Functions, MACs & Digital Signatures 3.3 Secure Protocols: SSL/TLS, IPsec & SSH

4 Chapter 4: Background Information Gathering & OSINT Reconnaissance

4.1 WHOIS Records, Domain Registrars & Autonomous Systems 4.2 DNS Infrastructure, Record Types & Zone Transfers 4.3 Search Engine Reconnaissance, Google Dorking & Information Leakage 4.4 Newsgroups, Mailing Lists & Public Archive Reconnaissance

5 Chapter 5: Networking Equipment & Infrastructure Protocols

5.1 Router & Switch Management: SNMP, SSH & Authentication 5.2 Layer 2 Protocols: ARP, CDP, STP, VTP & Redundancy 5.3 Core Network Services: DHCP, NTP & TFTP 5.4 Wireless Security (802.11) & VoIP Assessment 5.5 Out-of-Band Management, Console Access & Cisco Reverse Telnet

6 Chapter 6: Network Mapping, Nmap Techniques & Target Identification

6.1 Host Discovery Techniques & Ping Sweep Methodologies 6.2 Port Scanning Mechanics: TCP, UDP & Stealth Scans 6.3 OS Fingerprinting, Service Detection & Timing Templates 6.4 Firewall and IDS/IPS Evasion Techniques 6.5 Passive OS & Service Fingerprinting 6.6 Network Access Control Analysis & Firewall Rule Base Review

7 Chapter 7: Vulnerability Identification & Tool Output Analysis

7.1 Vulnerability Scanning Principles & Methodology 7.2 CVE Referencing, CVSS Scoring & Risk Prioritisation 7.3 Banner Grabbing, Service Verification & Manual Triage 7.4 Host Audit Techniques: Processes, Sockets, Patch Levels & Interesting Files

8 Chapter 8: Microsoft Windows Security Assessment & Active Directory

8.1 Active Directory Architecture & Domain Reconnaissance 8.2 Windows User & Group Enumeration via SMB & RPC 8.3 Windows Authentication: NTLM, Kerberos & Password Security 8.4 Windows Patch Management, Local Security & Common Services 8.5 Windows File System, Share & Registry Permissions 8.6 Desktop Lockdown, Citrix Breakout & Common Windows Applications

9 Chapter 9: Unix & Linux Security Assessment & Legacy Services

9.1 Linux/Unix Security Architecture, Permissions & Filesystem 9.2 Unix User Enumeration & Service Discovery 9.3 Network File System (NFS) & RPC Services Assessment 9.4 Legacy Unix Services: R-Services, X11, FTP & Modern SSH 9.5 Unix Remote Information Services: rusers, rwho, finger & systat 9.6 Unix Vulnerability Exploitation & Post-Exploitation Workflow

10 Chapter 10: Web Architectures, Technologies & Testing Methodologies

10.1 Web Server Architecture & the HTTP/HTTPS Protocol 10.2 Web Application Components, Frameworks & State Management 10.3 Web Reconnaissance, Content Discovery & Threat Modelling 10.4 Testing Authentication, Authorization & Session Management 10.5 Web Service Protocols: SOAP, REST & XML Messaging 10.6 Web APIs, Server Extensions & Client-Side Sub-Components

11 Chapter 11: Web Testing Techniques & OWASP Top Vulnerabilities

11.1 Input Validation Vulnerabilities & Parameter Manipulation 11.2 Cross-Site Scripting (XSS): Types, Impact & Defenses 11.3 Cross-Site Request Forgery (CSRF) & Client-Side Attacks 11.4 Command Injection, File Upload Vulnerabilities & API Flaws 11.5 Information Disclosure: Error Messages & Mark-up Leakage 11.6 Injection Beyond SQL: LDAP, XPath, Code & Template Injection 11.7 Source Code Review & Encoded/Cryptographic Value Analysis

12 Chapter 12: Database Security Assessment & SQL Injection

12.1 Database Architectures, Default Ports & Authentication 12.2 SQL Injection (SQLi) Foundations & In-Band Techniques 12.3 Blind SQL Injection & Database Enumeration 12.4 Database Attack Vectors, Stored Procedures & Hardening

6.3 OS Fingerprinting, Service Detection & Timing Templates

Key Takeaways Explain This Topic AI

Nmap active OS fingerprinting (-O) transmits 16 specifically crafted probe packets to open and closed ports, evaluating TCP options, ISN predictability, IP ID generation, and ICMP response formatting against nmap-os-db.

Accurate OS detection strictly requires discovering at least one open TCP port and at least one closed TCP port on the target machine.

Service and version detection (-sV) queries open ports using hierarchical probes from nmap-service-probes, controllable via version intensity levels ranging from 0 (light) to 9 (comprehensive).

Nmap timing templates (-T0 through -T5) govern aggressiveness and packet delays, where -T4 is the professional penetration testing standard for modern networks, while -T0 and -T1 are used for stealth and IDS evasion.

Last updated: September 2026

6.3 OS Fingerprinting, Service Detection & Timing Templates

Once live hosts and open ports have been mapped, the next critical phase of technical reconnaissance involves target identification : determining the exact operating system, kernel version, software daemons, and application patch levels running on target systems. Identifying whether an open port on port 80 is Microsoft IIS 10.0 on Windows Server 2022 or Apache 2.4.52 on Ubuntu 22.04 completely dictates subsequent vulnerability assessment and exploitation strategies.

Active Operating System Fingerprinting Mechanics ( -O )

Operating system fingerprinting determines the identity and version of a target operating system by analyzing subtle variations in how different vendors implement the TCP/IP protocol suite (RFC 791, 793, 1122). +-----------------------------------------------------------------------------+

  • | NMAP ACTIVE OS DETECTION ARCHITECTURE |
  • +-----------------------------------------------------------------------------+
  • | 1. Discovers >= 1 Open TCP Port AND >= 1 Closed TCP Port |
  • | 2. Transmits 16 Specially Crafted Probe Packets: |
  • | - 6 TCP Sequence Probes (T1 - T6) to Open Port |
  • | - 1 Explicit Congestion Notification Probe (ECN) to Open Port |
  • | - 6 TCP Flag/Option Probes (T2 - T7) to Open/Closed Ports |
  • | - 2 ICMP Probes (Echo Request with varied flags/TOS) |
  • | - 1 UDP Probe to Closed Port (PU) |
  • | 3. Records Bit-Level Header Fields and Generates Fingerprint |
  • | 4. Matches Fingerprint against nmap-os-db Signature Database |
  • +-----------------------------------------------------------------------------+
  • The 16 Probe Packets and Analysis Tests

When -O is invoked, Nmap transmits a sequence of 16 specific probe packets to the target host and evaluates the returning responses across dozens of distinct header attributes:

TCP Initial Sequence Number (ISN) Sampling: Nmap transmits six consecutive TCP SYN packets to an open port (spaced 100ms apart). It analyzes how the target operating system generates sequence numbers:

Linear Increment: Older Windows or embedded devices increment ISNs by constant values.

Random Increments: Modern Linux and modern Windows kernels implement cryptographically secure pseudo-random number generators (CSPRNG).

Nmap calculates an ISN Predictability Index (scoring difficulty of TCP sequence prediction attacks / blind TCP connection spoofing).

IP Identification (IP ID) Sequence Generation: Analyzes how the target increments the 16-bit IP Identification field in the IPv4 header across consecutive responses:

Incremental global counter (common in older kernels and network printers).

Incremental per-socket counter.

Completely randomized values (standard in modern Linux).

Constant values (e.g., all zeros, common in FreeBSD).

TCP Options Ordering and Negotiation: Different operating systems support different TCP options and order them uniquely within the TCP header. Nmap evaluates:

Maximum Segment Size (MSS) negotiation.

Window Scale (RFC 1323) support and multiplier factor.

Selective Acknowledgment (SACK-Permitted, RFC 2018).

TCP Timestamps (TSval and TSecr).

NOP (No-Operation) padding alignment. Example: Linux typically orders options as MSS, SACK, Timestamp, NOP, Window Scale , whereas Windows orders them as MSS, NOP, Window Scale, SACK, Timestamp .

TCP Initial Window Size: Examines the static or dynamic initial Window size advertised in the target's SYN-ACK response (e.g., 64240 in Windows 10/11 vs 65160 in modern Linux).

Response to Bogus and Invalid Flag Combinations: Nmap sends probes with illegal TCP flag combinations (such as SYN+FIN, or PSH+FIN+URG without an established session) to evaluate how the target stack reacts. Some operating systems drop illegal packets, while others reply with RST or echo flags.

ICMP Response Formatting: Analyzes the ICMP Echo reply generated by the target: checks whether the IP Total Length was modified, whether the IP Time to Live (TTL) is 64 (Linux/Unix), 128 (Windows), or 255 (Cisco/network gear), and whether the ICMP code field is zeroed.

UDP to Closed Port (PU Probe): Transmits a UDP packet to a closed port to elicit an ICMP Port Unreachable message. Nmap checks the quoted IP header within the ICMP payload—specifically whether the original IP ID, Total Length, and UDP checksum were preserved accurately by the target kernel.

The Golden Rule of Nmap OS Fingerprinting

Prerequisite for OS Detection: To achieve a high-confidence OS fingerprint match, Nmap strictly requires finding at least one OPEN TCP port and at least one CLOSED TCP port on the target system. The open port is needed to evaluate connection options, ISN predictability, and window scaling; the closed port is needed to test RST generation, flag quirks, and ICMP port unreachable handling. If all ports are open or all ports are filtered, OS detection confidence drops significantly or fails entirely.

Fingerprint Matching: nmap-os-db

The extracted response metrics are assembled into a structured text fingerprint and compared against the nmap-os-db database, which contains thousands of curated operating system signatures. If an exact match is not found, Nmap uses a weighted algorithm to present the closest matching operating system family and confidence percentage.

Service and Version Detection Mechanics ( -sV )

Simply knowing that port 80 is open is insufficient; a penetration tester must determine whether the service is Apache, Microsoft IIS, Nginx, or an embedded administrative portal. Nmap's Service and Version Detection engine ( -sV ) determines software identity and version information. Scanner Target Port 22

  • |------------------- 1. TCP Handshake ----------------->| (Port Open)
  • |<------------------ 2. Wait for Banner ---------------| (Null Probe)
  • | "SSH-2.0-OpenSSH_8.9p1 Ubuntu" |
  • | [Matched in nmap-service-probes] |
  • Scanner Target Port 80
  • |------------------- 1. TCP Handshake ----------------->| (Port Open)
  • | [No Banner Returned] |
  • |------------------- 2. Send Probe: GetRequest --------->|
  • |<------------------ 3. HTTP/1.1 200 OK ---------------|
  • | Server: Apache/2.4.52 (Ubuntu) |
  • | [Regex Match -> Service Identified]|
  • The nmap-service-probes Database and Probe Sequence

Service detection is driven by the nmap-service-probes file. The process follows a structured sequence:

Null Probe (Waiting for Greeting Banners): Nmap establishes a TCP connection and waits a few seconds without transmitting any data. Many daemons (e.g., FTP, SSH, SMTP, POP3, Telnet) immediately transmit an initial welcome banner upon connection. If a banner is received, Nmap matches it against defined regular expressions.

Protocol-Specific Probes: If the Null probe elicits no response (as with HTTP, DNS, RPC, or SSL), Nmap steps through a sequence of active probe strings defined in the database:

GetRequest : Sends an HTTP GET / HTTP/1.0 request.

HTTPOptions : Sends an HTTP OPTIONS / HTTP/1.0 request.

RTSPRequest : Sends a streaming protocol probe.

SSLSessionReq / TLSSessionReq : Initiates a TLS Client Hello to detect encrypted services.

TerminalServer : Probes for Microsoft RDP.

Pattern Matching ( match and softmatch ): Returned data is evaluated against database directives:

softmatch : Provides a broad, initial classification (e.g., identifies that the service is an HTTP server), allowing Nmap to prioritize subsequent HTTP-specific probes.

match : Employs Perl-Compatible Regular Expressions (PCRE) to extract detailed metadata: vendor product, software version, operating system, and hostname.

Version Intensity Levels

The depth of service detection is governed by the --version-intensity option, which accepts integer values from 0 to 9 :

Intensity Level Option Flag Description

0 - 1 Customized Minimal probing; tests only the Null probe and the single most probable probe.

2 --version-light Light mode; tests only the most common probes. Fast execution, but misses obscure services.

7 Default (no flag) Standard balance; executes probes with a rarity rating of 7 or lower. Optimal for general testing.

9 --version-all Maximum intensity; attempts every single probe in nmap-service-probes against every open port. Essential when standard services run on non-standard ports (e.g., HTTP on port 53).

Nmap Timing Templates ( -T0 to -T5 )

Nmap provides six predefined timing templates that control probe parallelization, round-trip time (RTT) timeouts, packet delays, and scan aggressiveness. Calibrating timing templates allows testers to balance assessment speed against operational stealth and network stability. -T0 (Paranoid) : Ultra-slow, serial, 5 min delay --> IDS Evasion

  • T1 (Sneaky) : Very slow, serial, 15 sec delay --> Network Throttling
  • T2 (Polite) : Slowed, serial, 0.4 sec delay --> Bandwidth Preservation
  • T3 (Normal) : Dynamic, adaptive parallel probes --> Default Production Mode
  • T4 (Aggressive): Fast, max RTT 1.25s, min delay 10ms-> Pen Testing Standard
  • T5 (Insane) : Extreme speed, max RTT 300ms --> Lab / High-Speed Fabric
  • Detailed Breakdown of Timing Templates

-T0 (Paranoid):

Probes are strictly serialized (only one port probed at a time across the entire scan).

Enforces a mandatory 5-minute (300-second) delay between consecutive probes.

Purpose: Evading Intrusion Detection Systems (IDS) configured with threshold-based alert rules that detect multiple probe packets arriving within short time windows.

Practical Note: Scanning the top 1,000 ports on a single host at -T0 takes approximately 3.5 days.

-T1 (Sneaky):

Serialized probing with a 15-second delay between consecutive packets.

Used for stealthy perimeter testing where IDS thresholds are somewhat relaxed.

-T2 (Polite):

Serialized probing with a 0.4-second delay between probes.

Purpose: Preserving network bandwidth and preventing overloaded target hosts (e.g., legacy industrial PLC devices or fragile medical appliances) from crashing.

-T3 (Normal):

Nmap's default timing mode.

Dynamically adapts probe rates based on network responsiveness and observed packet latency.

Executes probes in parallel, adjusting timeouts dynamically.

-T4 (Aggressive):

The industry standard for professional penetration testing engagements on modern, reliable networks.

Caps maximum RTT timeout at 1.25 seconds and initial RTT timeout at 500 milliseconds.

Caps maximum scan delay at 10 milliseconds .

Accelerates scan execution significantly without sacrificing accuracy on low-loss networks.

-T5 (Insane):

Assumes an extraordinarily fast, dedicated network fabric (gigabit Ethernet or local VM switches).

Caps maximum RTT timeout at 300 milliseconds and probe delays at 5 milliseconds.

Capped host timeout of 15 minutes.

Operational Risk: On standard corporate networks or internet connections, -T5 sends packets faster than intermediate network queues and target socket buffers can handle. Packets are dropped, leading to false negatives (missed open ports) .

Nmap Scripting Engine (NSE)

The Nmap Scripting Engine (NSE) extends Nmap's core architecture using an embedded Lua interpreter. NSE scripts automate advanced service discovery, configuration auditing, banner harvesting, and vulnerability identification.

The 14 NSE Script Categories

Every script in Nmap belongs to one or more predefined categories:

  • Category Description & Operational Purpose Example Scripts
  • auth Evaluates authentication controls and tests default credentials. http-default-accounts , ftp-anon
  • broadcast Discovers hosts by broadcasting discovery queries to the local link. broadcast-dhcp-discover
  • default Fast, safe, low-overhead scripts executed automatically via -sC . ssl-cert , ssh-hostkey , http-title
  • discovery Interrogates services to map public records, shares, and resources. smb-enum-shares , dns-brute
  • dos Tests for denial-of-service vulnerabilities; may crash services. smb-vuln-ms10-054
  • exploit Actively exploits known vulnerabilities to gain unauthorized access. http-shellshock
  • external Sends queries to third-party public databases (e.g., Whois, Shodan). whois-ip , shodan-api
  • fuzzer Transmits randomized or malformed payloads to test software stability. http-form-fuzzer
  • intrusive High-risk scripts that may trigger alarms or crash systems. http-sql-injection
  • malware Tests whether the target is infected by backdoors, trojans, or worms. smtp-strangeport
  • safe Low-risk scripts designed to never crash services or consume bandwidth. banner , http-headers
  • version Extends the -sV version detection engine for rare services. rfc868-time
  • vuln Scans for specific known Common Vulnerabilities and Exposures (CVEs). smb-vuln-ms17-010 , ssl-heartbleed
  • NSE Command Execution Patterns # Execute default scripts alongside standard SYN scan and version detection
  • nmap -sS -sV -sC 10.10.10.50
  • # Scan for known vulnerabilities while strictly excluding dangerous denial-of-service scripts
  • nmap --script "vuln and not dos" 10.10.10.50
  • # Audit SSL/TLS cipher suites and supported protocol versions
  • nmap -p 443 --script ssl-enum-ciphers 10.10.10.50
  • # Enumerate Windows SMB shares and Active Directory domain information
  • nmap -p 445 --script smb-enum-shares,smb-os-discovery 10.10.10.50