Loading content...
For decades, NTP was designed for a more trusting internet. The original protocol included virtually no security mechanisms—servers broadcast time, clients accepted it, and the assumption was that everyone was cooperating in good faith. That assumption no longer holds.
Time manipulation is a potent attack vector. An adversary who can shift your clock can:
This page examines the threats facing NTP, legacy authentication mechanisms, and modern solutions like Network Time Security (NTS) that bring cryptographic protection to time synchronization.
By the end of this page, you will understand the threat model for NTP and the attacks that can compromise time synchronization, legacy NTP authentication using symmetric keys and Autokey, the modern Network Time Security (NTS) protocol that provides authenticated, encrypted NTP, best practices for securing NTP deployments, and monitoring and detection strategies for time-based attacks.
Understanding NTP security requires understanding the adversaries and their capabilities. The threat model ranges from accidental misconfiguration to sophisticated nation-state attacks.
| Threat Actor | Capabilities | Goals |
|---|---|---|
| On-Path Attacker | Can observe and modify traffic between client and server | Manipulate time responses, drop packets, delay traffic |
| Off-Path Attacker | Cannot see traffic but can send spoofed packets | Inject fake NTP responses, DDoS amplification |
| Malicious Server Operator | Controls an NTP server the client trusts | Provide false time to targeted or all clients |
| BGP Hijacker | Can redirect internet traffic through their network | Become on-path attacker for arbitrary client-server pairs |
| Compromised Infrastructure | Controls DNS, routing, or network equipment | Redirect NTP traffic, respond to queries with false data |
| Insider Threat | Has administrative access to client or server | Misconfigure NTP, disable authentication, install malicious software |
Attack categories:
1. Time Shifting Attacks
2. Denial of Service Attacks
3. Traffic Analysis Attacks
4. Man-in-the-Middle Attacks
NTP is foundational infrastructure—like DNS and BGP. Attacks on NTP don't just affect time; they cascade into authentication systems, logging, databases, and any system that depends on accurate timestamps. The impact of a successful NTP attack is almost always broader than it first appears.
NTP's design creates several specific vulnerabilities that attackers can exploit. Understanding these vectors is essential for both defending and detecting attacks.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
NTP Attack Vectors══════════════════════════════════════════════════════════════════════════ 1. PACKET SPOOFING (Off-Path Attack)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Attack: Attacker sends forged NTP responses claiming to be from trusted servers Prerequisites: - Know the client's IP address - Know the server's IP address - Predict or guess the origin timestamp (T1) - Beat the legitimate response (race condition) Client Attacker Server │ │ │ │───Request───────────────────►│ │ │ │ │◄──Fake Response─┤ │ │ (spoofed src IP) │ │ │ │ │ │◄──Real Response (arrives second, ignored) Defense: - NTS authentication (cryptographic binding) - Origin timestamp validation (unpredictable T1) - Multiple diverse sources (consensus detection) ────────────────────────────────────────────────────────────────────────── 2. DENIAL-OF-SERVICE AMPLIFICATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Attack: Use NTP servers to amplify and reflect DDoS traffic Technique: NTP "monlist" command (mode 7, now disabled by default) - Small query (234 bytes) → Large response (up to 100× amplification) - Source IP spoofed to victim's address - Thousands of NTP servers flood victim simultaneously Attacker NTP Servers Victim │ │ │ │──monlist──────────────►├───────────────────────►│ │ (src=victim IP) │ (100× data) │ │──monlist──────────────►├───────────────────────►│ │ (src=victim IP) │ (100× data) │ │ ... │ ... │ │ │ │◄─FLOODED Impact: Massive DDoS attacks (2014 NTP amplification attacks peaked at 400 Gbps) Defense: - Disable monlist (restrict queries to local) - Rate limiting - BCP38 source address validation ────────────────────────────────────────────────────────────────────────── 3. KISS-OF-DEATH (KoD) DENIAL OF SERVICE━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Attack: Send forged KoD packets to make clients stop querying legitimate servers Technique: - Spoof packets from server IP with stratum 0 - Include DENY or RSTR kiss code - Well-behaved clients will stop using that server Attacker Client Server │ │ │ │──Fake KoD (DENY)──────►│ │ │ (src=server IP) │ │ │ │───X───X───X─── │ │ │ (stops queries) │ Defense: - Authenticated NTP (NTS) - Multiple sources (single KoD doesn't disable all) - KoD rate limiting and validation ────────────────────────────────────────────────────────────────────────── 4. TIME SHIFTING (On-Path MITM)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Attack: Modify NTP packets in transit to shift the client's clock Technique: - Intercept and delay packets to skew time - Modify timestamp fields directly - Gradually shift time to avoid detection Gradual shift (more stealthy): - Introduce small offset per poll (e.g., 10ms/hour) - Stay under NTP's panic threshold - Accumulate significant shift over days Immediate shift: - Modify timestamps aggressively - May trigger detection but achieves immediate effect Defense: - NTS (cryptographic message authentication) - Physically diverse network paths - Out-of-band time verification (GPS receiver) ────────────────────────────────────────────────────────────────────────── 5. STRATUM MANIPULATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Attack: Manipulate stratum values to influence source selection Technique: - Advertise artificially low stratum to become preferred source - Raise legitimate sources' apparent stratum - Once selected as system peer, provide malicious time Defense: - Don't trust low stratum alone - Multiple diverse sources - Authenticated time sourcesThe single most effective defense against many NTP attacks is diversity: multiple servers, multiple network paths, multiple providers, potentially multiple protocols (NTP + PTP + GPS). An attacker who must compromise multiple independent sources faces a much harder challenge than one who only needs to compromise a single server.
NTP has included authentication mechanisms since the 1990s, but the legacy options have significant limitations.
Symmetric Key Authentication:
The original NTP authentication uses pre-shared symmetric keys. The server and client both know a key ID and secret; the client includes a MAC (Message Authentication Code) in its request, and the server validates it before responding.
Advantages:
Disadvantages:
123456789101112131415161718192021222324252627282930313233343536373839404142434445
Symmetric Key Authentication Configuration══════════════════════════════════════════════════════════════════════════ SERVER CONFIGURATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # /etc/chrony/chrony.conf (server)keyfile /etc/chrony/chrony.keysallow 192.168.1.0/24 # /etc/chrony/chrony.keys# Format: keyid algorithm secret1 SHA256 HEX:4e544b9c81f0a7e23a6d47c5f9b8e234a1b2c3d4e5f6a7b8c9d0e1f22 SHA256 HEX:a1b2c3d4e5f607890abcdef0123456789abcdef0123456789abcdef0 CLIENT CONFIGURATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # /etc/chrony/chrony.conf (client)keyfile /etc/chrony/chrony.keysserver 192.168.1.1 key 1 iburst # /etc/chrony/chrony.keys (same as server!)1 SHA256 HEX:4e544b9c81f0a7e23a6d47c5f9b8e234a1b2c3d4e5f6a7b8c9d0e1f2 KEY FILE PERMISSIONS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ $ chmod 400 /etc/chrony/chrony.keys$ chown root:root /etc/chrony/chrony.keys # Keys must be protected - anyone with the key can impersonate! VERIFICATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ $ chronyc ntpdataAuthenticated : Yes ← Successful authenticationTX key ID : 1RX key ID : 1 $ chronyc authdataName/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen=========================================================================192.168.1.1 NTP 1 SHA2 256 43m 0 0 0 0Autokey (deprecated):
Autokey was NTPv4's attempt to solve the key distribution problem using public key cryptography. Each server has a public/private key pair, and clients can verify responses without pre-shared secrets.
However, Autokey has been deprecated due to:
Do not use Autokey for new deployments. Use NTS instead.
Autokey has been removed from modern NTP implementations due to security vulnerabilities. If you find Autokey in a legacy configuration, plan to migrate to NTS (Network Time Security) or fall back to monitored unauthenticated NTP with multiple diverse sources.
Network Time Security (NTS), specified in RFC 8915 (2020), is the modern solution for authenticated NTP. It provides:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
Network Time Security (NTS) Protocol══════════════════════════════════════════════════════════════════════════ NTS consists of two sub-protocols: 1. NTS Key Establishment (NTS-KE): TLS handshake to exchange keys 2. NTS Extension Fields: Authenticating subsequent NTP packets ══════════════════════════════════════════════════════════════════════════ PHASE 1: NTS KEY ESTABLISHMENT (NTS-KE)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Client NTS-KE Server │ │ │ ────────── TLS 1.3 Handshake ──────────────────────►│ │ │ │ Server authenticates via TLS certificate │ │ Client verifies against trusted CA roots │ │ │ │ ◄─────────── TLS Established ──────────────────────│ │ │ │ ────────── NTS-KE Request ─────────────────────────►│ │ • Requested AEAD algorithms │ │ • NTP version │ │ │ │ ◄─────────── NTS-KE Response ──────────────────────│ │ • Selected AEAD algorithm (e.g., AES-SIV-CMAC) │ │ • NTP server address (may differ from KE server) │ │ • Cookies (usually 8) │ │ • End of message │ │ │ │ ────────── TLS Close ──────────────────────────────►│ │ │ Keys derived from TLS: C2S: Client-to-Server key (for authenticating requests) S2C: Server-to-Client key (for authenticating responses) These keys are used for subsequent NTP exchanges. ══════════════════════════════════════════════════════════════════════════ PHASE 2: AUTHENTICATED NTP PACKETS━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Client NTP Server │ │ │ ────────── NTP Request ────────────────────────────►│ │ Standard NTP header │ │ + Unique Identifier Extension (random nonce) │ │ + Cookie Extension (opaque blob from NTS-KE) │ │ + Cookie Placeholder (empty, for new cookies) │ │ + AEAD Authentication Tag (C2S key) │ │ │ │ ◄─────────── NTP Response ─────────────────────────│ │ Standard NTP header with timestamps │ │ + Unique Identifier (echoed from request) │ │ + New Cookie(s) for future use │ │ + AEAD Authentication Tag (S2C key) │ │ │ Client verification: 1. Verify AEAD tag using S2C key 2. Verify Unique Identifier matches request 3. If valid, accept timestamps and store new cookie 4. If invalid, discard response (possible attack) ══════════════════════════════════════════════════════════════════════════ COOKIE ROTATION AND PRIVACY━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Client uses one cookie per NTP request• Server returns new cookies in each response• Cookies are opaque; server decrypts to recover client keys• Cookie rotation prevents tracking clients across sessions• If cookies run out, client re-runs NTS-KE Cookie lifecycle: [NTS-KE] → 8 cookies ↓ [NTP #1] uses cookie 1 → receives 2 new cookies (total: 9) ↓ [NTP #2] uses cookie 2 → receives 2 new cookies (total: 9) ↓ ... continues, cookies always replenished ... ══════════════════════════════════════════════════════════════════════════Configuring NTS with chrony:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
NTS Configuration (Chrony)══════════════════════════════════════════════════════════════════════════ CLIENT CONFIGURATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # /etc/chrony/chrony.conf # NTS-enabled servers (use 'nts' keyword)server time.cloudflare.com iburst ntsserver nts.netnod.se iburst ntsserver ntppool1.time.nl iburst ntspool nts.pool.ntp.org iburst nts # Trust store for NTS-KE TLS certificates (usually system default)# ntstrustedcerts /etc/pki/tls/certs/ca-bundle.crt # NTS key/cookie storage (survives restarts)ntsdumpdir /var/lib/chrony # Standard options continue...driftfile /var/lib/chrony/driftmakestep 1.0 3rtcsync VERIFICATION━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ $ chronyc -N sourcesMS Name/IP address Stratum Poll Reach LastRx Last sample==============================================================================^* time.cloudflare.com 3 6 377 25 +234us[+567us] +/- 15ms^+ nts.netnod.se 1 6 377 24 -123us[ -12us] +/- 22ms^+ ntppool1.time.nl 1 6 377 26 +345us[+678us] +/- 25ms $ chronyc authdataName/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen==============================================================================time.cloudflare.com NTS 1 AEAD 256 25s 0 0 8 100nts.netnod.se NTS 1 AEAD 256 24s 0 0 8 100ntppool1.time.nl NTS 1 AEAD 256 26s 0 0 8 100 Legend: Mode: NTS = NTS authentication active KeyID: Key identifier Type: AEAD = Authenticated Encryption with Associated Data KLen: Key length in bits Cook: Number of cookies available CLen: Cookie length ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SERVER CONFIGURATION (to serve NTS)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # /etc/chrony/chrony.conf (server) # Enable NTS-KE server on port 4460ntsserverkey /etc/chrony/nts.keyntsservercert /etc/chrony/nts.crtntsprocesses 1 # Certificate must be trusted (Let's Encrypt works)# Key/cert permissions: readable only by chrony daemon # Allow NTP queries (authenticated via NTS or not)allow 0.0.0.0/0allow ::/0Major NTS providers include Cloudflare (time.cloudflare.com), Netnod (nts.netnod.se), and increasing numbers of pool.ntp.org servers. Check nts.pool.ntp.org for pool servers with NTS support. Always prefer NTS-capable servers when available—the security benefits are significant.
Whether or not you use NTS, there are many measures to harden your NTP deployment against attacks.
allow/deny directives.monlist command enables amplification attacks. Modern installations have it disabled by default, but verify.ratelimit in chrony, restrict options in ntpd.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
Hardened Chrony Configuration══════════════════════════════════════════════════════════════════════════ # /etc/chrony/chrony.conf # Use diverse NTS-enabled sources (4+ for Byzantine fault tolerance)server time.cloudflare.com iburst ntsserver nts.netnod.se iburst nts pool nts.pool.ntp.org iburst nts maxsources 4 # Non-NTS fallbacks (diverse geographical locations)pool pool.ntp.org iburst maxsources 2 # Store NTS keys and drift across restartsntsdumpdir /var/lib/chronydriftfile /var/lib/chrony/drift # Allow step only at startup (first 3 updates)makestep 1.0 3 # Sync RTC on kernels that support itrtcsync # Logging for security monitoringlogdir /var/log/chronylog tracking measurements statistics # ═══════════════════════════════════════════════════════════════════════# ACCESS CONTROL (for NTP servers)# ═══════════════════════════════════════════════════════════════════════ # Default: deny alldeny all # Allow local network to query timeallow 10.0.0.0/8allow 192.168.0.0/16 # Allow localhost (for chronyc)allow 127.0.0.1allow ::1 # Rate limit queries to prevent abuseratelimit interval 1 burst 16 # ═══════════════════════════════════════════════════════════════════════# COMMAND INTERFACE SECURITY# ═══════════════════════════════════════════════════════════════════════ # Only allow local commands (no network control)bindcmdaddress 127.0.0.1bindcmdaddress ::1 # Require authentication for modify commandscmdallow 127.0.0.1cmddeny all # ═══════════════════════════════════════════════════════════════════════# ADDITIONAL HARDENING# ═══════════════════════════════════════════════════════════════════════ # Lock memory (prevent paging secrets to disk)lock_all # Privilege separation (chrony drops root after startup)# (This is default behavior on most distributions) # Maximum source distance - reject sources with high uncertaintymaxdistance 3.0 # Minimum number of sources before accepting timeminsources 2NTP uses UDP port 123. Stateful firewalls should allow outbound NTP (to configured servers) and track responses. Avoid allowing inbound UDP/123 from the entire internet unless you're intentionally running a public NTP server—and if you are, implement rate limiting and monitoring.
Leap seconds are a security-adjacent concern because incorrect handling can cause system failures. Understanding how NTP handles leap seconds—and the alternatives—is important for reliable operations.
What are leap seconds?
Earth's rotation is gradually slowing, while atomic clocks maintain constant rate. To keep UTC aligned with solar time, the IERS (International Earth Rotation and Reference Systems Service) occasionally adds a "leap second"—an extra second at the end of June 30 or December 31.
During a positive leap second:
23:59:58 UTC
23:59:59 UTC
23:59:60 UTC ← The leap second (60 seconds in the minute!)
00:00:00 UTC ← Next day
| Strategy | How It Works | Pros/Cons |
|---|---|---|
| Step (traditional) | Clock shows 23:59:60, then 00:00:00 | True to UTC; but some software crashes on :60 second |
| Repeat (ntpd default) | Clock shows 23:59:59 twice | Some software sees time go backward briefly |
| Smear (Google/AWS) | Distribute extra second over hours | No discontinuity; but clock disagrees with UTC during smear |
| Ignore (not recommended) | Pretend it doesn't exist | Clock drifts 1 second from UTC; dangerous |
Leap second smearing (Google's approach):
Google, AWS, and other cloud providers implement "leap second smearing," where the extra second is gradually applied over typically 12-24 hours around the leap second event. During this period, their clocks run very slightly slow or fast, but there's no discontinuity.
Important: Don't mix smearing and non-smearing sources! If you use time.google.com (smearing) and pool.ntp.org (stepping), NTP may detect them as falsetickers during the smear window because they disagree by up to 500ms.
The ITU voted in 2022 to eliminate leap seconds by 2035, allowing the difference between UTC and UT1 (solar time) to grow. This will eventually require a larger correction, but removes the ongoing operational risk of leap second handling. Until 2035, leap seconds remain a concern.
Proactive monitoring can detect NTP attacks before they cause damage. Here are key metrics to monitor and alert on:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
NTP Monitoring Script Example══════════════════════════════════════════════════════════════════════════ #!/bin/bash# ntp_check.sh - Monitor NTP health metrics # Get chrony tracking dataTRACKING=$(chronyc tracking) # Extract key metricsSTRATUM=$(echo "$TRACKING" | grep "Stratum" | awk '{print $3}')OFFSET=$(echo "$TRACKING" | grep "System time" | awk '{print $4}')ROOT_DELAY=$(echo "$TRACKING" | grep "Root delay" | awk '{print $4}')LEAP_STATUS=$(echo "$TRACKING" | grep "Leap status" | cut -d: -f2 | tr -d ' ') # Count reachable sourcesSOURCES=$(chronyc sources | grep -E "^^" | wc -l)REACHABLE=$(chronyc sources | grep -E "^^[*+]" | wc -l) # Alert thresholdsMAX_STRATUM=5MAX_OFFSET=0.1 # 100msMIN_SOURCES=3 echo "NTP Health Check - $(date)"echo "================================"echo "Stratum: $STRATUM (max: $MAX_STRATUM)"echo "Offset: $OFFSET seconds"echo "Root Delay: $ROOT_DELAY"echo "Sources: $REACHABLE / $SOURCES reachable"echo "Leap Status: $LEAP_STATUS"echo "" # Check for alertsALERT=0 if [ "$STRATUM" -gt "$MAX_STRATUM" ]; then echo "⚠️ ALERT: Stratum $STRATUM exceeds threshold $MAX_STRATUM" ALERT=1fi if [ "$REACHABLE" -lt "$MIN_SOURCES" ]; then echo "⚠️ ALERT: Only $REACHABLE sources reachable (min: $MIN_SOURCES)" ALERT=1fi if [ "$LEAP_STATUS" != "Normal" ]; then echo "⚠️ ALERT: Leap status is $LEAP_STATUS" ALERT=1fi # Check for falsetickersFALSETICKERS=$(chronyc sources | grep -E "^^x" | wc -l)if [ "$FALSETICKERS" -gt 0 ]; then echo "⚠️ ALERT: $FALSETICKERS sources marked as falsetickers" chronyc sources | grep -E "^^x" ALERT=1fi exit $ALERT ══════════════════════════════════════════════════════════════════════════ PROMETHEUS/GRAFANA METRICS (node_exporter + chrony)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Useful metrics from chrony_exporter: chrony_tracking_stratum - Current stratum chrony_tracking_system_time - Offset in seconds chrony_tracking_root_delay_seconds - Delay to root chrony_tracking_root_dispersion - Dispersion to root chrony_sources_count - Number of configured sources chrony_tracking_last_offset_seconds - Last measured offset Alert rules (PromQL): # Stratum too high chrony_tracking_stratum > 5 # Large offset abs(chrony_tracking_last_offset_seconds) > 0.1 # Lost sources (assuming 4 configured) chrony_sources_count < 4Combine multiple layers: use NTS for authentication, monitor for anomalies, use diverse sources for consensus, and for critical systems, deploy an independent GPS/atomic reference that can detect if all network time sources are being manipulated.
Time security is critical infrastructure security. As we've seen, attacks on NTP can cascade into authentication failures, data corruption, and system-wide outages. Let's consolidate the key security concepts:
Module Complete
Congratulations! You've completed the NTP module. You now understand:
This knowledge equips you to design, deploy, secure, and troubleshoot time synchronization in any environment—from small offices to global-scale distributed systems.
You've mastered the Network Time Protocol—from the physics of clock drift through the elegance of the selection algorithms to the cryptographic protections of NTS. Time synchronization may be invisible to most users, but you now understand the sophisticated infrastructure that makes distributed computing possible.