Applications, chapter 33 of 36
Time, Shells, and Files: NTP, SSH, Telnet, and FTP
A shifted clock and an asymmetric path produce the same four NTP timestamps, so no endpoint can detect the error.
Before the browser trusts the certificate for www.example.net, it compares two dates inside it with the laptop's clock. Nobody watched that clock being set. A 48-byte UDP payload to port 123 did it, some time before the click. In our exchange with the access ISP's time server 198.51.100.123, the laptop's clock is 300 ms slow.
- 2036
- the year the 32-bit seconds of an NTP timestamp wrap, at 06:28:16 UTC on 7 February
- 556.9
- average bandwidth amplification of NTP's
monlistin 2014, 4,670 for the most productive tenth of servers - 27
- leap seconds since 1972, the last at the end of 2016
Four timestamps, two clocks
One NTP exchange between the laptop and the ISP's time server, drawn against the server's clock, which the figure takes as true time. Pull the two one-way delays apart and watch the computed offset drift from the true one by half the difference.
Why does a web page depend on the laptop's clock?
Certificate path validation checks that the validity period includes the current time (RFC 5280, Section 6.1.3), and on the laptop that is the system clock. DNSSEC checks every RRSIG against the same clock, so a clock that is wrong in either direction breaks both.
Network Time Security needs a certificate check of its own before the clock is known to be right, and RFC 8915, Section 8.5 admits the circle. systemd keeps a record of the last synchronized time, and at boot it moves a clock that is behind that record forward [Systemd2026].
How do four timestamps become an offset?
T1 and T4 come from the laptop's clock, T2 and T3 from the server's. RFC 5905, Section 8 computes the offset as ((T2-T1) + (T3-T4)) / 2 and the round-trip delay as (T4-T1) - (T3-T2). For our laptop, 300 ms slow, that gives 300.100 ms and 4.000 ms.
The delay is exact, because the server's processing time cancels. The offset assumes equal delays both ways, and ours were 2.1 ms out and 1.9 ms back. Half the difference is the error, and the only bound on it is half the delay.
What happens to the extra second?
UTC follows the Earth's rotation to within 0.9 seconds by inserting leap seconds, and the NTP leap indicator warns of one (RFC 5905, Section 7.3). POSIX time has no 23:59:60. Linux handles the inserted second by setting the clock back one second, so 23:59:59 happens twice [Linux2026].
In October 2026 the General Conference on Weights and Measures made UTC continuous from 20 May 2027 [BIPM2026]. It cites a 30 percent chance of a first negative leap second by 2035, a step nobody has ever taken.
Why could an 8-byte request return 44,000 bytes?
One mode 7 command of the reference implementation, monlist, returned the server's recent clients. In 2014 Christian Rossow found that most implementations accepted it in a short form of 8 bytes and replied with up to 100 datagrams of 440 bytes of payload each [Rossow2014].
The repair came from operators. RFC 8633, Section 3.4 recommends that public servers block control queries from outside. Newer designs rule the problem out: Roughtime asks for requests of at least 1,024 bytes over UDP and forbids larger answers (RFC 10049, Section 5.1).
What did Telnet settle for every protocol after it?
Telnet is older than TCP: C. Stephen Carr proposed it in RFC 15 on 25 September 1969. RFC 854 escapes commands with IAC, octet 255, and four commands negotiate options: WILL, WONT, DO, and DONT.
A party may always refuse to enable an option but must never refuse to disable one, so both sides can fall back to the Network Virtual Terminal. TLS extensions and the SSH name-lists repeat the recipe: a baseline that always works, and offers an old implementation can refuse without harm.
Why do NATs and firewalls fight FTP?
Active mode needs an inbound connection to a port chosen on the fly, and the address travels in the payload: the laptop writes its private 192.168.1.23 into the PORT command. Steve Bellovin's RFC 1579 (1994) proposed that clients send PASV, so the server listens. Its 227 reply still carries an address, and a server behind its own NAT announces one the client cannot reach.
RFC 2428 (1998) removed the address. The 229 reply to EPSV carries only a port, (|||50021|), and the client reuses the control connection's address, which also makes FTP work over IPv6.
How did Terrapin delete messages from an encrypted channel?
The exchange hash authenticates a fixed list of handshake values, and every implementation must accept SSH_MSG_IGNORE at any time (RFC 4253, Section 11.2). An attacker in the path injects one IGNORE toward the client during the plaintext handshake and deletes the first encrypted message from the server. The sequence numbers agree again before any MAC is checked [Baeumer2024].
In a scan of IPv4 port 22 in early October 2023, 71.6 percent of servers supported a vulnerable mode. OpenSSH 9.6 answered with strict KEX: when both sides announce it, each NEWKEYS resets the sequence number to zero, against the "never reset" of RFC 4253, Section 6.4.
The book keeps asking
This chapter has 5,553 words and 15 questions. These 8 are answered only in the book and the audiobook.
- What is in a 48-byte time packet?
- How does a daemon move the clock without making it jump?
- How can a client authenticate time before it knows the time?
- Why is Telnet still on the Internet?
- Why does FTP open a second connection?
- How did SSH replace all of this?
- What runs inside the encrypted tunnel?
- How did SSH key exchange become post-quantum?
Open the sources
- RFC 5905 Network Time Protocol Version 4: Protocol and Algorithms Specification
- RFC 8915 Network Time Security for the Network Time Protocol
- RFC 10049 Roughtime: A Protocol for Rough Time Synchronization
- RFC 854 Telnet Protocol Specification
- RFC 959 File Transfer Protocol
- RFC 4251 The Secure Shell (SSH) Protocol Architecture
- RFC 4253 The Secure Shell (SSH) Transport Layer Protocol
- [OpenSSH2026] OpenSSH portable source tree, master after release 10.6 (commit 721ad09d8, 1 November 2026)
All 61 documents this chapter cites, each with a link to its publisher and a copy kept here.
