Cheat sheet

Zeek logs

Zeek turns network traffic into structured logs, one per protocol. The analysis approach is in Network Traffic Analysis.

CDSACJCANetwork

The logs

FileContents
conn.logOne line per connection: addresses, ports, protocol, duration, volumes
dns.logDNS queries and answers
http.logHTTP requests: method, host, URI, user agent, response code
ssl.logTLS sessions: version, requested name (server_name), certificate
files.logFiles seen on the network, with their hashes
x509.logCertificates observed
ssh.logSSH connections and authentication result
smb_files.logFiles read or written over SMB
notice.logAlerts raised by Zeek scripts
weird.logProtocol anomalies
# Analyse a capture: one .log file per protocol in the current folder
zeek -C -r capture.pcap
# Pick columns
cat conn.log | zeek-cut id.orig_h id.resp_h id.resp_p service duration orig_bytes
# Most contacted destinations
cat conn.log | zeek-cut id.resp_h | sort | uniq -c | sort -rn | head

conn.log fields

FieldMeaning
uidConnection identifier, repeated in the other logs
id.orig_hOriginator address
id.orig_pOriginator port
id.resp_hResponder address
id.resp_pResponder port
protoTransport protocol (tcp, udp, icmp)
serviceDetected application protocol (http, dns, ssl…)
durationConnection duration
orig_bytesBytes sent by the originator
resp_bytesBytes sent by the responder
conn_stateConnection state (S0, SF, REJ…)
Pivot with uidThe uid of a suspicious connection in conn.log finds its DNS query, HTTP request and transferred files in the other logs.

Connection states (conn_state)

StateMeaning
S0Attempt with no answer (SYN only)
S1Connection established, not yet terminated
SFConnection established then closed normally
REJAttempt rejected (RST in reply to the SYN)
RSTOConnection aborted by the originator (RST)
RSTRConnection aborted by the responder (RST)
OTHNo SYN seen: connection picked up midstream
What should raise a flagMany S0 or REJ from one source: scan. Regular connections of constant size to one destination: beaconing. orig_bytes far above resp_bytes: data being sent, possible exfiltration.