IDS Recap and Zeek-Based Hunting
Network sensors see every host that talks, including the ones without an agent: the printer, the old NAS, the contractor's laptop, the compromised IoT camera. A SOC usually runs two kinds of network sensor side by side: a signature IDS (Suricata or Snort) that says "this matched a known-bad pattern", and Zeek, which writes a structured log of every connection and protocol transaction so analysts can ask questions afterwards. The Network Security course teaches both in depth; this lesson recaps what the SOC uses them for, then hunts in Zeek-style logs for three things signatures miss: long-lived connections, rare client fingerprints, and connections that skip DNS.
Recap: what each sensor gives the SOC
| Signature IDS (Suricata, Snort) | Zeek | |
|---|---|---|
| Output | Alerts (eve.json in Suricata), optionally with the matching packet |
Logs: conn, dns, http, ssl, files, x509, notice… |
| Good at | Known exploits, known malware traffic, policy violations (cleartext passwords) | Behaviour over time, questions nobody thought of in advance, investigations |
| Weak at | Anything without a signature, encrypted payloads | Telling you what is bad without someone asking |
| Taught in | Suricata and Snort Rules, Tuning Alerts | Zeek Logs with pandas (scans, big uploads, fixed beacons, DNS) |
Suricata can also write protocol logs (DNS, HTTP, TLS, flows) into eve.json, so some SOCs run it alone; Zeek's logs are richer and its scripting language more flexible. Both need a copy of the traffic: a SPAN port or a network TAP at the Internet edge and in front of critical segments, and they see only what is not encrypted or what the handshake reveals.
What encrypted traffic still reveals
Most traffic is TLS, yet the handshake is still informative: the server name the client asked for (SNI, unless Encrypted Client Hello is used), the ALPN protocols, the certificate (in TLS 1.2; in TLS 1.3 it is encrypted), and a client fingerprint computed from the ClientHello's version, cipher suites and extensions: JA3 (an MD5 hash of those fields) or the newer, more readable JA4. The same malware family tends to produce the same fingerprint, and a fingerprint that only one host in the company has is worth a look. The session reads the bundled sample captures (in your sandbox; no network):
echo "== TLS ClientHello: who, which name, which client fingerprint"
tshark -r $SAMPLES/pcap/tls.pcap -Y 'tls.handshake.type == 1' -T fields -E separator='|' \
-e ip.src -e ip.dst -e tls.handshake.extensions_server_name -e tls.handshake.extensions_alpn_str \
-e tls.handshake.ja3 -e tls.handshake.ja4
echo "== HTTP requests: method, host, URI, user agent"
tshark -r $SAMPLES/pcap/http.pcap -Y http.request -T fields -E separator='|' \
-e ip.src -e http.request.method -e http.host -e http.request.uri -e http.user_agent== TLS ClientHello: who, which name, which client fingerprint
10.10.0.5|10.10.0.10|lab.test|h2,http/1.1|9f093ce75416f083f2c887d8c093feb7|t13d0507h2_c96ac5133cd7_17a634208175
== HTTP requests: method, host, URI, user agent
10.10.0.5|GET|www.lab.test|/|lab-client/1.0
10.10.0.5|POST|www.lab.test|/login|lab-client/1.0
A Zeek sensor writes the same facts into ssl.log (server name, version, and with a package, JA3/JA4) and http.log (method, host, URI, user agent), one line per transaction, for every host, all day.
Three hunts in Zeek-style logs
The program hunts over a synthetic day of conn, ssl, http and dns data from the lab network.
import pandas as pd
conn = pd.DataFrame([ # uid, src, dst, port, duration_s, orig_bytes, resp_bytes
("C1", "10.10.0.21", "198.51.100.40", 443, 35, 4_100, 210_000),
("C2", "10.10.0.22", "198.51.100.41", 443, 12, 2_300, 98_000),
("C3", "10.10.0.15", "203.0.113.66", 443, 31_800, 1_900_000, 410_000), # 8.8 hours, steady both ways
("C4", "10.10.0.40", "198.51.100.42", 443, 41_000, 9_000, 8_500), # printer's cloud connector, idle
("C5", "10.10.0.23", "198.51.100.40", 443, 50, 6_000, 330_000),
("C6", "10.10.0.15", "192.0.2.200", 8443, 4, 1_200, 900), # no DNS lookup before it
], columns=["uid", "src", "dst", "port", "duration", "orig_bytes", "resp_bytes"])
ssl = pd.DataFrame([ # JA4 values are synthetic placeholders in the real format
("C1", "docs.example", "t13d1516h2_8daaf6152771_02713d6af862"),
("C2", "news.example", "t13d1516h2_8daaf6152771_02713d6af862"),
("C3", "upd.cdn-lab.example", "t12d190800_d83cc789557e_7af1ed941c26"),
("C4", "print.vendor.example", "t12d0909h1_a1b2c3d4e5f6_0f9e8d7c6b5a"),
("C5", "docs.example", "t13d1516h2_8daaf6152771_02713d6af862"),
("C6", "", "t12d190800_d83cc789557e_7af1ed941c26"),
], columns=["uid", "server_name", "ja4"])
http = pd.DataFrame({"src": ["10.10.0.21"] * 40 + ["10.10.0.22"] * 35 + ["10.10.0.15"] * 3 + ["10.10.0.40"] * 2,
"user_agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/142.0"] * 75
+ ["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"] * 3 + ["LabPrinter/2.1"] * 2})
dns_answers = {"198.51.100.40", "198.51.100.41", "203.0.113.66", "198.51.100.42"} # addresses some DNS answer returned
KNOWN_LONG = {("10.10.0.40", "198.51.100.42"): "printer cloud connector (asset db)"}
print("1) long connections (> 1 h), by duration")
for r in conn[conn.duration > 3600].sort_values("duration", ascending=False).itertuples():
note = KNOWN_LONG.get((r.src, r.dst), "UNKNOWN")
print(f" {r.src} -> {r.dst}:{r.port} {r.duration / 3600:.1f} h, up {r.orig_bytes / 1e6:.2f} MB, down {r.resp_bytes / 1e6:.2f} MB [{note}]")
print("2) rare TLS client fingerprints (seen from 1 host)")
fp = conn.merge(ssl, on="uid").groupby("ja4").agg(hosts=("src", "nunique"), names=("server_name", lambda s: sorted(set(s))))
print(fp[fp.hosts == 1].to_string())
print("3) rare user agents (fewer than 5 % of HTTP requests)")
ua = http.user_agent.value_counts(normalize=True)
for agent, share in ua[ua < 0.05].items():
print(f" {share:.1%} {agent} from {sorted(http[http.user_agent == agent].src.unique())}")
print("4) connections to addresses no DNS answer returned")
print(" ", conn[~conn.dst.isin(dns_answers)][["src", "dst", "port"]].to_string(index=False, header=False))1) long connections (> 1 h), by duration
10.10.0.40 -> 198.51.100.42:443 11.4 h, up 0.01 MB, down 0.01 MB [printer cloud connector (asset db)]
10.10.0.15 -> 203.0.113.66:443 8.8 h, up 1.90 MB, down 0.41 MB [UNKNOWN]
2) rare TLS client fingerprints (seen from 1 host)
hosts names
ja4
t12d0909h1_a1b2c3d4e5f6_0f9e8d7c6b5a 1 [print.vendor.example]
t12d190800_d83cc789557e_7af1ed941c26 1 [, upd.cdn-lab.example]
3) rare user agents (fewer than 5 % of HTTP requests)
3.8% Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1) from ['10.10.0.15']
2.5% LabPrinter/2.1 from ['10.10.0.40']
4) connections to addresses no DNS answer returned
10.10.0.15 192.0.2.200 8443
Every hunt returns something, and two kinds of results appear side by side:
- Long connections: two sessions last more than an hour. The printer's 11.4-hour connection to its vendor is known (the asset database says so) and nearly idle.
10.10.0.15's 8.8-hour session to203.0.113.66is unknown and active in both directions, which is what an interactive remote-control channel looks like. - Rare fingerprints: two JA4 values are seen from only one host each. One is the printer again. The other belongs to
10.10.0.15, used both forupd.cdn-lab.example(the domain the DNS beaconing lesson flagged) and for a connection without any server name. - Rare user agents: the printer's own agent, and an Internet Explorer 8 string on Windows 7 coming from
10.10.0.15, a Windows 11 laptop. Old browser strings are a favourite disguise of hand-written HTTP clients. - No DNS:
10.10.0.15also connected straight to192.0.2.200:8443, an address no DNS answer ever returned.
Four independent weak signals point at one host. The printer appears in three hunts and is explained each time by the asset inventory, which is the point of keeping it current. Hunting results are leads for an analyst, not verdicts: here they are strong enough to open a case on 10.10.0.15.
How these hunts become detections
Each hunt that finds something worth repeating becomes a rule or a scheduled report (Hypothesis-Driven Hunting):
- Long connections: scheduled daily, minus an allow-list of known long-lived services (VPN tunnels, printer and IoT connectors, video calls), owned by the asset owners.
- Rare fingerprints: fingerprints seen on fewer than N hosts in 30 days and talking to rare destinations; fingerprints from threat-intel feeds as indicators (with the caution that common libraries share fingerprints).
- Direct-to-IP connections from workstations to the Internet on unusual ports: rare in normal use, common for malware and tools.
How the weaknesses are fixed
The hunts find hosts talking where they shouldn't; the fixes stop that talk:
- Egress filtering and proxies (Egress Filtering): workstations reach the Internet only through a proxy that requires authentication, which by itself breaks many tools that connect directly to IP addresses.
- TLS inspection where policy and law allow, for categories of traffic where the risk justifies it, with privacy-sensitive categories excluded.
- Segment IoT and printers so a compromised device can only reach its vendor's service.
- Retire legacy clients: an Internet Explorer 8 user agent in 2026 is either malware pretending or an unsupported system; both need to go.
Pitfalls
- Sensors in the wrong place. A sensor at the Internet edge sees nothing of lateral movement between internal hosts; put one in front of the server segments too.
- Packet loss on the sensor. An overloaded sensor drops packets silently; monitor its capture-loss statistics (Zeek's
capture_loss.log). - Fingerprints as identity. JA3/JA4 identify a TLS library and its configuration, not a program; many unrelated programs share one. Use them as a rarity signal, not as proof.
Practice
1. The C3 connection uploaded 1.9 MB over 8.8 hours. Why can this be more suspicious than a 1.9 GB upload?
A slow, steady, interactive-looking session (data in both directions over hours) to a domain only one host uses, with a rare TLS fingerprint, looks like a remote-control channel. A large upload is noticeable for its volume; a C2 session is noticeable for its duration and its rarity. Both deserve a look; the first is easier to miss.
2. C6 has no server name and goes to 192.0.2.200:8443 without a DNS lookup. Name two benign and two malicious explanations.
Benign: an application with a hard-coded IP (some update or licensing services), a developer testing a lab server. Malicious: malware with a hard-coded C2 address (avoiding DNS logging), a tool fetching a payload from an attacker-controlled server. The shared JA4 with C3 tips the balance here.
3. Write the allow-list entry for the printer's long connection.
src 10.10.0.40, dst 198.51.100.42, port 443, server_name print.vendor.example, owner: facilities IT, reason: vendor cloud connector (asset record), expiry: 12 months. Plus a separate check that the printer talks to nothing else.
Test yourself
What does a JA3 or JA4 fingerprint describe?
- The server's certificate
- The client's TLS ClientHello: version, cipher suites and extensions
- The user's password
- The HTTP body
Why did the long-connection hunt flag C3 and not C4?
- C4 was shorter
- C4 is a known printer connector in the allow-list; C3's destination and fingerprint are unknown and rare
- C3 used port 80
- C4 had no bytes
What can a network sensor see of TLS 1.3 traffic without decryption?
- Nothing
- Handshake metadata such as SNI (unless ECH is used), ALPN and the client fingerprint, plus sizes and timing
- The full content
- Only the port number
Why is a connection to an IP address that no DNS answer returned worth hunting?
- It is always an error
- Normal software mostly connects by name; hard-coded addresses are common in malware and tools
- DNS is mandatory by law
- It is faster