Lesson 7 of 19 · 22m
Network Forensics: Reading Packets and Hunting Beacons
Turn Zeek logs, flow records, and TLS metadata into a C2 map — beacon regularity, JA3/SNI mismatches, and the DNS tells attackers can't hide.
The disk told you what ran; the network tells you who it talked to. Most organizations keep no full packet capture — pcap is expensive to store — so network forensics is usually three cheaper sources fused together: Zeek or firewall flow logs, DNS resolver logs, and whatever TLS metadata survived. Learn to read all three, because you'll rarely get the luxury of all of them.
The evidence hierarchy
- Full pcap — everything, heavy, usually only captured reactively once you suspect something.
tcpdump/dumpcapon a SPAN port or the host itself. - Zeek logs — the standard middle layer. Zeek turns traffic into structured logs (
conn.log,dns.log,http.log,ssl.log) with durations, byte counts, and state — searchable for months, a fraction of pcap's size. - NetFlow / VPC Flow Logs — 5-tuples, packet/byte counts, no payload. In AWS, VPC Flow Logs are off by default and must be enabled per VPC — check that during triage, not after.
- Resolver and proxy logs — DNS lookups and HTTP(S) requests. The cheapest, most underused scoping source in any org.
Hunting the beacon
C2 traffic hides in volume, not in port. The tells in conn.log or flow data:
- Regularity: a process that phones home every 300 seconds ±2% is not a user browsing — compute mean and standard deviation of inter-connection intervals per destination.
- Long-lived sessions: check
duration— a 14-hour TCP session to a residential ASN is a channel, not a page load. - Asymmetry: small outbound, large inbound (or the reverse for exfil) is a session doing work, not fetching content.
- Rare destinations: sort connections by destination frequency across the fleet; the IP that exactly one host talks to every five minutes is interesting by definition.
# tshark: DNS query counts from a pcap
tshark -r capture.pcap -Y dns -T fields -e dns.qry.name | sort | uniq -c | sort -rn | head -30
# Zeek conn.log: connections sorted by duration
awk -F'\t' '{print $5, $7, $9}' conn.log | sort -k3 -rn | head -20TLS doesn't hide the interesting part
The payload is encrypted; the metadata isn't. The ClientHello still carries SNI in plaintext (unless ECH is deployed — rare in enterprise C2 today), and the TLS stack's own fingerprint betrays the client: JA3/JA4 hashes the cipher suites, extensions, and curves a client offers. A Python-based beacon presenting to a microsoft.com SNI produces a JA3 that no Edge browser ever sends — mismatched SNI and JA3 is a detection that survives full encryption. Certificate transparency logs (crt.sh) work the other direction: enumerate the attacker's certs for a domain and find the sibling infrastructure they stood up beside it.
DNS is the other leak. DGA domains produce NXDOMAIN bursts in dns.log; DNS-tunneling exfil produces absurdly long query names and TXT-record responses with high entropy. DNS over HTTPS closes this source, so the IR-era answer is: log or block known DoH endpoints at the proxy, or accept the blind spot explicitly.
Mind the quiet channels too: exfil over HTTP POST shows as upload-heavy sessions in http.log, ICMP tunneling shows as non-echo ICMP payloads, and QUIC rides UDP so a "TCP-only" filter in your flow review misses it. If your tooling only indexes TCP, you're auditing a fraction of the wire.
Two mechanical details pay rent. The uid field is Zeek's spine — the same value links a conn.log row to its dns.log query, http.log request, and ssl.log handshake, so pivoting is a grep, not a join. And ssl.log is where the TLS metadata this lesson leans on actually lives: server_name (the SNI), ja3/ja3s fingerprints, cert validation_status — while x509.log holds the full chain when a cert looks forged. On fingerprints: JA4 (FoxIO, 2023) is the GREASE-aware successor that also fingerprints QUIC — prefer it where your tooling supports it.
When you have nothing captured
Then capture now. During an active incident you stand up the telemetry you wish you'd had: a tcpdump ring buffer on the suspect host (tcpdump -i any -w /evidence/net.pcap -C 100 -W 10), Zeek on a tapped uplink, resolver query logging cranked up. Evidence collection during an incident isn't cheating; it's how real cases get made, and the attacker who survived your scoping will phone home again into a logged network.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
CVE-2025-62718: Critical Axios SSRF Vulnerability Explained
A critical SSRF flaw in Axios was used in a North Korean supply chain attack. Here's what it does and how to patch it today.
Attacks of UPS Devices are on the Rise warns CISA
Hackers have now begun to attack internet-connected universal power supply devices. They are targeting their control interfaces via multiple remote code execution vulnerabilities. In some of the cases, they changed the default usernames and passwords, according to an important advisory from the…
Immich Had Fourteen Advisories and One Bug It Fixed Three Times
Immich's 2026 security record runs to fourteen advisories, and they cluster hard: the sharing features, the OAuth plumbing, and one login redirect parameter that took three separate fixes across eighty-three days. Plus the 3.0 migration traps still waiting for anyone who hasn't jumped yet.
Jellyfin's Threat Model Is Your Brother-in-Law
Four Jellyfin CVEs landed in 2026 and not one of them needs an admin account. One needs only the ability to name a file. Meanwhile Jellyfin 12 shipped in September, the version numbers stopped starting with 10, and every "am I patched" check you wrote is now wrong.