SSH and DNS in a quiet capture
Reading a packet capture that holds an encrypted SSH session and plain DNS lookups side by side, and what each one leaves visible.
When Paul Mockapetris defined the Domain Name System in 1983, in RFCs 882 and 883, it sent questions and answers in the clear, like nearly everything on the network then. Twelve years later Tatu Ylönen found a password sniffer on the Helsinki University of Technology’s network and wrote SSH so that logins would stop crossing the wire readable. A single capture can hold both designs side by side. This one does.
The first fifteen of the capture’s 200 packets in Wireshark.
What the capture holds
The file, sample.pcap, comes from a virtual machine at 172.21.224.2. Most of its traffic is an SSH session with 35.235.244.34. The VM sends from port 22, so it is the server; the client, on port 35193, sits in the range Google Cloud uses for its Identity-Aware Proxy, the service behind SSH sessions opened from a browser.
In among the SSH packets are DNS lookups. The VM asks for both the A (IPv4) and the AAAA (IPv6) records of opensource.google.com, and the answers come back with Google’s addresses, 142.250.1.139 among them. The resolver it asks is 169.254.169.254, a link-local address; on Google Compute Engine the metadata server at that address also answers DNS. Resolution was working normally.
What encryption hides, and what it leaves
Multiple TCP ACKs and payloads Wireshark can only label “Encrypted packet” confirm an active session and nothing about its content. But TCP flags and sequence numbers sit outside the encryption, and they are enough to correlate a flow even when the payload is opaque.
Sizes and timing leak too. In 2001 Dawn Song, David Wagner and Xuqing Tian showed that the gaps between packets in an interactive SSH session reveal enough about keystroke timing to narrow the search for a password typed inside it. OpenSSH answered only in version 9.5, in 2023, by sending keystrokes at fixed intervals mixed with decoy packets.
DNS has no cover at all. Every name the VM looked up is readable, and the answers with it; encrypted DNS exists, but most networks still answer in the clear on port 53.
A baseline
This is what a quiet system looks like at the packet level: a few lookups, an encrypted session, ordinary TCP bookkeeping. Knowing that picture comes before anything else, because anomaly detection is comparing traffic against a baseline, whatever the tooling calls it.
Sources
- Mockapetris, P. RFC 882, “Domain Names: Concepts and Facilities,” and RFC 883, “Domain Names: Implementation and Specification.” November 1983.
- Ylönen, Tatu. “SSH: Secure Login Connections over the Internet.” Proceedings of the 6th USENIX Security Symposium, 1996.
- Song, Dawn Xiaodong, David Wagner and Xuqing Tian. “Timing Analysis of Keystrokes and Timing Attacks on SSH.” Proceedings of the 10th USENIX Security Symposium, 2001.
- OpenSSH 9.5 release notes, October 2023.
- Google Cloud. “Using IAP for TCP forwarding” and “Internal DNS” documentation.