Skip to main content
Network Forensics: Session Reconstruction & TLS Metadata
Lesson 10 of 20

Network Forensics: Session Reconstruction & TLS Metadata

Reconstruct TCP and application sessions from packet captures, extract transferred files with Wireshark and Zeek, and analyze TLS handshake metadata to spot suspicious encrypted traffic.

Advanced 30 min Forensics & IR

Learning objectives

  • Reassemble TCP streams and carve transferred files from packet captures without corrupting payload bytes
  • Correlate multi-protocol network activity using Zeek connection identifiers and log fields
  • Interpret cleartext TLS handshake metadata including SNI, ALPN, cipher suites, and client fingerprints
  • Distinguish benign encrypted traffic from anomalous command-and-control or exfiltration sessions

Recommended first: Incident Response Lifecycle & Triage ContainmentBrowser Artifacts (SQLite/Cache) & Super-Timeline AnalysisMemory Forensics with Volatility 3

#Why this matters

Host artifacts from disk and memory show what ran on a single endpoint, yet they often miss how an attacker arrived, moved laterally, or staged data off the network. Packet captures (PCAPs) and flow logs fill that gap by recording the exact wire-level conversations between hosts. Even when modern applications wrap traffic in TLS 1.3 encryption, the surrounding metadata -- timing, byte ratios, DNS lookups, and handshake parameters -- still reveals which processes communicated and whether a session warrants deeper triage.

#From raw packets to reconstructed sessions

A packet capture stores individual frames rather than complete files or application messages. To read what a user or program actually sent, an analyst reconstructs the session using the five-tuple: source IP address, source port, destination IP address, destination port, and transport protocol (such as TCP or UDP).

For TCP traffic, reassembly relies on sequence numbers and acknowledgment numbers. Packets on a busy link frequently arrive out of order, get fragmented across MTU boundaries, or appear twice because of retransmissions. Reassembly engines sort segments by sequence number, discard duplicate retransmissions, and strip transport headers to leave a clean application byte stream.

  1. CaptureRead PCAP in Wireshark, tshark, or Zeek
  2. FilterIsolate suspicious five-tuple or protocol
  3. ReassembleOrder TCP segments and drop retransmissions
  4. CarveExtract transferred objects or logs
  5. VerifyCompute SHA-256 and correlate with host timeline

Different tools serve complementary roles during reconstruction:

Tool Primary strength Typical forensic output
Wireshark Interactive packet dissection and stream view Follow TCP/HTTP stream, Export Objects
tshark Scriptable CLI extraction over large PCAPs Filtered CSV tables, stream ASCII/hex dumps
Zeek High-speed protocol logging and correlation Linked conn.log, dns.log, ssl.log, files.log
NetworkMiner Automated passive artifact carving Extracted images, executables, host profiles

In Wireshark, opening Follow and selecting TCP Stream (or HTTP Stream) reconstructs one bidirectional conversation, while File / Export Objects extracts files transferred over HTTP, SMB, or IMF. NetworkMiner automates this carving across an entire capture, grouping reconstructed files and credentials by host IP.

#Extracting payloads with tshark and Zeek

When a capture spans gigabytes, interactive GUIs slow down. Command-line tools such as tshark and Zeek extract structured metadata and carved files repeatably.

Zeek processes a PCAP into tab-separated or JSON logs. Crucially, Zeek tags every session with a shared uid field. An analyst who spots a suspicious transfer in files.log can grep that same uid across conn.log, http.log, dns.log, and ssl.log to trace the full chain from name resolution to payload delivery.

Reconstructing sessions and HTTP transfers in a lab PCAP
$ tshark -r lab_capture.pcap -Y "http.request || http.response" -T fields \
  -e frame.time_utc -e ip.src -e ip.dst -e http.request.method -e http.request.uri
2026-11-18 14:12:03.114 UTC 10.10.10.25 192.0.2.40 GET /updates/patch.tar.gz

$ tshark -r lab_capture.pcap --export-objects http,./carved_http
$ sha256sum ./carved_http/patch.tar.gz
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08  ./carved_http/patch.tar.gz

$ zeek -r lab_capture.pcap
$ zeek-cut uid id.orig_h id.resp_h orig_bytes resp_bytes conn_state < conn.log | head -n 3
CHhAvVGS1DHFjwGM9   10.10.10.25   192.0.2.40   148   4829104   SF

Notice the conn_state value SF, which in Zeek denotes a normal TCP SYN-to-FIN establishment and teardown, alongside orig_bytes (148 bytes sent) and resp_bytes (4.8 MB received). Recording the SHA-256 hash of ./carved_http/patch.tar.gz immediately bridges network evidence to host forensics or malware triage.

#Analyzing encrypted traffic via TLS metadata

Encryption hides HTTP headers and file bodies, not the connection envelope. Both TLS 1.2 and TLS 1.3 begin with cleartext handshake negotiation so client and server can agree on cryptographic parameters.

TLS 1.3 handshake visibility on the wireTLS 1.3 handshake visibility on the wireClientServerClientHello (cleartext: SNI, ALPN, cipher suites, extensions)ServerHello (cleartext: chosen cipher, key share)EncryptedExtensions + Certificate + Finished (encrypted in TLS 1.3)Finished + Application Data (encrypted)TLS 1.3 encrypts the server certificate; TLS 1.2 sends Certificate in cleartext

Because TLS 1.3 encrypts the server certificate and handshake extensions after ServerHello, analysts rely more heavily on ClientHello features and flow statistics than in TLS 1.2:

Metadata field Where observed Analytical value
SNI (server_name) Cleartext ClientHello Reveals requested domain unless Encrypted Client Hello (ECH) is used
ALPN Cleartext ClientHello / ServerHello Shows negotiated application protocol (such as h2 or http/1.1)
JA3 / JA4 hash Derived from ClientHello Identifies client library (for example Python urllib vs corporate browser)
X.509 Issuer & Subject Cleartext in TLS 1.2 Certificate Flags self-signed, newly issued, or mismatched certificates
Byte ratio & duration Flow logs (conn.log) High upload-to-download ratio or periodic beacons indicate staging or C2

A browser visiting a legitimate portal produces a standard browser JA3/JA4 profile, resolves a domain via corporate DNS first, and downloads far more bytes than it uploads. By contrast, a standalone script connecting directly to a raw IP address without prior DNS, or using a non-browser TLS library fingerprint while sending large outbound byte counts, stands out immediately in ssl.log and conn.log.

#Common mistakes and defensive considerations

Analysts routinely lose evidence or misread sessions through four avoidable errors:

  • Filtering only on well-known ports. Attackers run HTTP on port 8443 or raw TLS on port 80. Use protocol dissectors (such as http or tls display filters) and Zeek dynamic protocol detection instead of assuming port 443 equals TLS.
  • Carving corrupted streams. Exporting bytes manually from raw packets without TCP reassembly can include duplicate retransmissions, altering the carved file's SHA-256 hash. Always carve from a reassembled stream and verify checksums.
  • Expecting TLS 1.3 server certificates in PCAPs. When TLS 1.3 is negotiated without a corporate decryption proxy or pre-master secret key log (SSLKEYLOGFILE in a lab), server certificates are encrypted on the wire; plan detections around ClientHello fingerprints, DNS correlation, and flow behavior.
  • Ignoring clock offsets. Merging PCAP timestamps recorded in local time with UTC host logs produces broken timelines. Always verify timezone settings and normalize to UTC before reporting.

From a defensive standpoint, organizations improve visibility by logging DNS queries alongside Zeek conn.log and ssl.log, baseline-profiling normal JA3/JA4 fingerprints per subnet, and alerting on TLS sessions that bypass internal DNS or exhibit strongly outbound-skewed byte ratios.

#Summary

  • Session reconstruction groups packets by five-tuple and reorders TCP sequence numbers while stripping duplicate retransmissions.
  • tshark, Wireshark, NetworkMiner, and Zeek extract carved payloads and link multi-protocol records through shared identifiers such as Zeek's uid.
  • Even under TLS 1.3, cleartext ClientHello fields (SNI, ALPN, JA3/JA4), absent DNS queries, and asymmetric byte ratios expose anomalous sessions.
  • Always hash carved artifacts with SHA-256 and normalize capture timestamps to UTC before correlating with host evidence.

Knowledge check

Sign in to take the test, complete lessons and save your progress. Log in

Practice: test your knowledge