Performing Network Traffic Analysis with Zeek
Overview
Zeek (formerly Bro) is an open-source network analysis framework that operates as a passive network security monitor. Unlike traditional signature-based IDS tools, Zeek generates high-fidelity structured logs from observed network traffic, capturing detailed metadata for protocols including HTTP, DNS, TLS, SSH, SMTP, FTP, and dozens more. Zeek's extensible scripting language enables custom detection logic, behavioral analysis, and automated response. This skill covers deploying Zeek, understanding its log architecture, writing custom detection scripts, and integrating outputs with SIEM platforms.
When to Use
- When conducting security assessments that involve performing network traffic analysis with zeek
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Linux server (Ubuntu 22.04+ or CentOS 8+) with 4+ CPU cores and 8GB+ RAM
- Network TAP or SPAN port mirroring configured for traffic capture
- Zeek 6.0+ installed (via package manager or source compilation)
- Root or capture group privileges for packet capture
- SIEM platform (Splunk, ELK Stack, or QRadar) for log ingestion
Core Concepts
Zeek Architecture
Zeek operates in two main modes:
- Live Capture - Monitors traffic in real-time on one or more network interfaces
- Offline Analysis - Processes saved PCAP files for retrospective analysis
The processing pipeline consists of:
- Packet Capture Layer - Reads raw packets from interfaces or PCAP files
- Event Engine - Reassembles TCP streams and generates protocol events
- Script Interpreter - Executes Zeek scripts that process events and generate logs
- Log Framework - Writes structured logs in TSV, JSON, or custom formats
Log Architecture
Zeek generates protocol-specific log files:
| Log File |
Description |
conn.log |
TCP/UDP/ICMP connection summaries with duration, bytes, state |
dns.log |
DNS queries and responses with query type, answers, TTL |
http.log |
HTTP requests/responses with URIs, user agents, MIME types |
ssl.log |
TLS handshake details including certificate chain, JA3/JA3S |
files.log |
File transfers with MIME types, hashes (MD5, SHA1, SHA256) |
notice.log |
Alerts generated by Zeek detection scripts |
weird.log |
Protocol anomalies and unexpected behaviors |
x509.log |
Certificate details from TLS connections |
smtp.log |
Email metadata including sender, recipient, subject |
ssh.log |
SSH connection details and authentication results |
pe.log |
Portable Executable file metadata |
dpd.log |
Dynamic Protocol Detection failures |
Workflow
Step 1: Install and Configure Zeek
# Install Zeek on Ubuntu
sudo apt-get install -y zeek
# Or install from Zeek repository
echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_22.04/ /' | \
sudo tee /etc/apt/sources.list.d/zeek.list
sudo apt-get update && sudo apt-get install -y zeek-lts
# Verify installation
zeek --version
Configure the node layout in /opt/zeek/etc/node.cfg:
[manager]
type=manager
host=localhost
[proxy-1]
type=proxy
host=localhost
[worker-1]
type=worker
host=localhost
interface=eth0
lb_method=pf_ring
lb_procs=4
[worker-2]
type=worker
host=localhost
interface=eth1
lb_method=pf_ring
lb_procs=4
Configure network definitions in /opt/zeek/etc/networks.cfg:
# Internal network ranges
10.0.0.0/8 Private RFC1918
172.16.0.0/12 Private RFC1918
192.168.0.0/16 Private RFC1918
Step 2: Configure Logging and Output
Edit /opt/zeek/share/zeek/site/local.zeek:
> 📎 Detailed content (full examples / references / data tables) has been split into `reference.md` in the same directory; use Read to load the relevant section on demand.
1---2name: performing-network-traffic-analysis-with-zeek3description: "Deploys Zeek passive network monitoring with protocol logs and SIEM detection scripts. Signals: Zeek, network monitoring, protocol logs, threat detection, SIEM."4zh-signals: "部署 Zeek 被动网络监控,产出 HTTP/DNS/TLS 等结构化协议日志,写定制检测脚本对接 SIEM。信号:zeek,网络监控,协议日志,威胁检测,siem。"5when-to-use: Deploy Zeek (formerly Bro) as a passive network security monitor to generate structured logs of protocol metadata (HTTP, DNS, TLS, SSH, SMTP, FTP, and more), write custom detection scripts, and integr6domain: cybersecurity7subdomain: network-security8tags:9- zeek10- network-monitoring11- traffic-analysis12- ids13- nids14- pcap15- threat-detection16- forensics17- siem-integration18version: '1.0'19author: mahipal20license: Apache-2.021nist_csf:22- PR.IR-0123- DE.CM-0124- ID.AM-0325- PR.DS-0226mitre_attack:27- T104628- T104029- T155730- T107131- T1685.00232metadata:33 source: https://skillmd.com/skills/dangeroussong/performing-network-traffic-analysis-with-zeek34---3536# Performing Network Traffic Analysis with Zeek3738## Overview3940Zeek (formerly Bro) is an open-source network analysis framework that operates as a passive network security monitor. Unlike traditional signature-based IDS tools, Zeek generates high-fidelity structured logs from observed network traffic, capturing detailed metadata for protocols including HTTP, DNS, TLS, SSH, SMTP, FTP, and dozens more. Zeek's extensible scripting language enables custom detection logic, behavioral analysis, and automated response. This skill covers deploying Zeek, understanding its log architecture, writing custom detection scripts, and integrating outputs with SIEM platforms.414243## When to Use4445- When conducting security assessments that involve performing network traffic analysis with zeek46- When following incident response procedures for related security events47- When performing scheduled security testing or auditing activities48- When validating security controls through hands-on testing4950## Prerequisites5152- Linux server (Ubuntu 22.04+ or CentOS 8+) with 4+ CPU cores and 8GB+ RAM53- Network TAP or SPAN port mirroring configured for traffic capture54- Zeek 6.0+ installed (via package manager or source compilation)55- Root or capture group privileges for packet capture56- SIEM platform (Splunk, ELK Stack, or QRadar) for log ingestion5758## Core Concepts5960### Zeek Architecture6162Zeek operates in two main modes:63641. **Live Capture** - Monitors traffic in real-time on one or more network interfaces652. **Offline Analysis** - Processes saved PCAP files for retrospective analysis6667The processing pipeline consists of:6869- **Packet Capture Layer** - Reads raw packets from interfaces or PCAP files70- **Event Engine** - Reassembles TCP streams and generates protocol events71- **Script Interpreter** - Executes Zeek scripts that process events and generate logs72- **Log Framework** - Writes structured logs in TSV, JSON, or custom formats7374### Log Architecture7576Zeek generates protocol-specific log files:7778| Log File | Description |79|----------|-------------|80| `conn.log` | TCP/UDP/ICMP connection summaries with duration, bytes, state |81| `dns.log` | DNS queries and responses with query type, answers, TTL |82| `http.log` | HTTP requests/responses with URIs, user agents, MIME types |83| `ssl.log` | TLS handshake details including certificate chain, JA3/JA3S |84| `files.log` | File transfers with MIME types, hashes (MD5, SHA1, SHA256) |85| `notice.log` | Alerts generated by Zeek detection scripts |86| `weird.log` | Protocol anomalies and unexpected behaviors |87| `x509.log` | Certificate details from TLS connections |88| `smtp.log` | Email metadata including sender, recipient, subject |89| `ssh.log` | SSH connection details and authentication results |90| `pe.log` | Portable Executable file metadata |91| `dpd.log` | Dynamic Protocol Detection failures |9293## Workflow9495### Step 1: Install and Configure Zeek9697```bash98# Install Zeek on Ubuntu99sudo apt-get install -y zeek100101# Or install from Zeek repository102echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_22.04/ /' | \103 sudo tee /etc/apt/sources.list.d/zeek.list104sudo apt-get update && sudo apt-get install -y zeek-lts105106# Verify installation107zeek --version108```109110Configure the node layout in `/opt/zeek/etc/node.cfg`:111112```ini113[manager]114type=manager115host=localhost116117[proxy-1]118type=proxy119host=localhost120121[worker-1]122type=worker123host=localhost124interface=eth0125lb_method=pf_ring126lb_procs=4127128[worker-2]129type=worker130host=localhost131interface=eth1132lb_method=pf_ring133lb_procs=4134```135136Configure network definitions in `/opt/zeek/etc/networks.cfg`:137138```139# Internal network ranges14010.0.0.0/8 Private RFC1918141172.16.0.0/12 Private RFC1918142192.168.0.0/16 Private RFC1918143```144145### Step 2: Configure Logging and Output146147Edit `/opt/zeek/share/zeek/site/local.zeek`:148149```zeek150151> 📎 Detailed content (full examples / references / data tables) has been split into `reference.md` in the same directory; use Read to load the relevant section on demand.