Vigil Scores the Phone-Home
Vigil already reads alerts. I wrote about that in No SOC Is an Island. Before this change, a beacon reached Vigil only after some other system had already described it.
A beacon is a connection that repeats on a regular rhythm. A planted program calls out on a timer, asks for the next order, and goes quiet. The gap between check-ins is the clue.
A strobe is the opposite problem: a pair that connects so often it is basically one continuous shout. It is not keeping a beat, so it does not get a beat score.
Zeek is a network monitor. It watches traffic and writes logs. The connection log,
conn.log, is one line per connection: who talked to whom, when, how long it lasted, and how many bytes moved.
A SOC (Security Operations Center) is the team, or the software, that watches for attacks and responds to them.
What Vigil did before
A finding arrived with the rhythm already written down. The text might say a host connected every 60 seconds. The beacon review then graded that one flow. It read the frequency, the port, the name, and the byte counts that were already on the finding, and it sorted the flow into command and control, suspicious, or a benign timer such as a time server or an update check.
Command and control is the channel an attacker uses to send orders to a program they have already planted.
Vigil could judge a beacon story. It did not measure one. Nothing in Vigil read a Zeek conn.log, grouped the pairs, or scored how even the gaps were. If the alert never said “every 60 seconds,” Vigil had no beacon number to look at.
What my change adds
The new code reads the connection log itself. It groups each source address with each destination address, scores each pair, and prints the pairs with the highest scores first. A pair needs at least 4 connections or it is left off the list.
The daemon can now run that on a timer and file each pair as a finding. The console shows those findings the same way it shows any other. Nothing else about Vigil changes.
flowchart TD
log["Zeek conn.log"] --> pairs["Group by source and destination"]
pairs --> strobe{"86,400+ connections?"}
strobe -->|yes| fixed["Strobe: fixed 0.8"]
strobe -->|no| gate{"At least 4 connections?"}
gate -->|no| skip["Leave it off the list"]
gate -->|yes| timing["Timing"]
gate -->|yes| size["Size"]
gate -->|yes| chart["Hour chart"]
chart --> shape["Chart score"]
chart --> span["Duration score"]
timing --> total["Beacon score, 0 to 1"]
size --> total
shape --> total
span --> total
total --> level["Beacon threat level"]
fixed --> level
dur["Summed connection time"] --> longlevel["Long-connection threat level"]
level --> base["Pair threat: the higher level wins"]
longlevel --> base
The log goes in. A ranked list comes out. A pair that keeps a beat gets a beacon score; a pair that shouts gets a fixed score; both then land on a threat level.
The four grades behind a beacon score
Four grades go into the average, one quarter each. The weights can change. They have to add up to 1.
The timing grade looks at the gaps between connections. Even gaps score high. A little wobble around one interval still scores high. On the examples the tests repeat, a steady beat scores 1.0, gaps that only wobble from 98 to 102 seconds score 0.995, a short gap alternating with a long one scores 0.746, and a random set of gaps scores 0.083. Those figures are the timing grade alone.
The size grade asks the same question of the byte counts. A check-in often sends about the same amount each time. The size is bytes sent plus bytes received. If Zeek never measured the bytes sent, that row is left out. A dash on the bytes received counts as zero.
The chart cuts the log’s time span into 24 hour-long buckets and counts how many connections landed in each hour. A flat chart scores well, because one connection every hour is flat. A second grade looks for one or two common heights, which catches a pair that runs hard and then rests. That second grade stays at 0 unless the pair shows up in at least 11 hours. The higher of the two grades is kept.
The duration grade asks how long the pair kept it up. It scores 0 unless connections fall in at least 6 different hours. A perfect timer that only runs for an hour should not sit next to one that runs all day. Past that line, the grade keeps the higher of two numbers: how much of the log the pair fills, and the longest run of busy hours. Twelve hours in a row is a full streak. A run can wrap from the end of the window back to the start, so a pair that is quiet at noon and busy overnight still counts as one streak.
The shape to remember is the test that scores 1.0 overall. Twenty-four connections, one per hour, the same size every time, from the start of the window to the end. Every grade is 1.0.
When a pair is a strobe, not a beacon
A pair that connects at least 86,400 times is a strobe. That number is one connection every second for a full day, so it is the point where “keeping a beat” stops being the right description. A strobe skips the four grades entirely and carries a fixed score of 0.8 instead. The threshold and that fixed score are both settings.
This matters because the four grades measure regularity, and a firehose is not regular, it is just loud. Scoring it like a beacon buries the real timers under a pair that never stopped talking.
From a score to a threat level
A number from 0 to 1 is not yet a threat level. The second module turns a score into one. It maps a value onto four levels by interpolating between four thresholds and the four level scores they stand for: 0.2, 0.4, 0.6, and 0.8. Below the first threshold the value is not a threat and scores nothing; at the top threshold it caps at 0.8.
Two kinds of value go through that mapping.
A beacon score is scaled up to a 0 to 100 range and read against thresholds of 50, 75, 90, and 100. A pair that scores below 0.5 on the four grades is not a threat. A perfect 1.0 beacon lands on the top level.
A long connection is judged on time instead of rhythm. The code adds up how long each pair’s connections lasted, and reads that total against one hour, four hours, eight hours, and twelve hours. Under an hour scores nothing; twelve hours or more tops out. A connection that simply stays open for most of a day is its own kind of suspicious, whether or not it ever kept a beat.
A pair’s overall threat is the higher of its beacon level and its long-connection level. A strobe carries its fixed level. The full engines this code mirrors stack a few more numbers on top, but those need a database of history behind them. This code reads only the connection log, so it stops at the level the log alone can support.
What a high score means
A high score means the rhythm is regular. The far end may be an attacker, a time server, an update check, or a monitoring agent. The old beacon review still does the sorting, and only when a finding already describes the flow. This score does not call that review. It answers the question Vigil could not answer from the log: how much does this pair look like a timer?
The arithmetic follows an open-source beacon-scoring engine that SOC analysts already use, so a high number here means the same kind of regularity a hunter already recognizes. The thresholds and level scores match that engine’s shipped defaults for the same reason. This module is the scoring only. It reads a tab-separated conn.log and pairs IP addresses.
What wiring it in means
The wiring is built. A design review of my proposal settled its shape.
A periodic daemon sweep reads a configured conn.log, scores the pairs, and writes each pair as a Finding. The finding carries the data source “zeek”, the pair’s threat level as its anomaly score, and the four subscores in its entity context. A severity maps off the threat level, so a beacon finding sorts next to everything else the console already gates on.
Two details the review caught. Both are cheap and both are load-bearing.
First, a stable external id per pair. The findings table has a unique index on data source plus external id, and the ingestion path dedupes on it. Without a stable id like zeek:source->destination, every sweep run inserts a fresh copy of every pair and the feed fills with duplicates.
Second, the right keys in the entity context. The IP-exclusion filter reads a fixed list of address keys, and plain source is not one of them; src_ip and dst_ip are. Write the wrong keys and beacon findings silently skip the exclusions an analyst already set.
The sweep registers as one more scheduled task in the daemon, behind a config flag that ships off by default.
What stays out of the wiring, on purpose: no new table and no migration, because the Finding model already has a score field and a JSON context bag; no new API endpoint, because the findings query already filters by data source and by a minimum anomaly score; and no rollout through the detection inventory. That is the line between “wired in” and “a product change.”
One caution to carry into the build: the parser reads the whole log into memory. A multi-gigabyte conn.log will need a size cap before this runs against a full day on a busy network.
Where the work sits
The code is two scoring files plus the sweep on a branch called feat/beacon-scoring: core/ingestion/beacon_scoring.py for the grades and the ranking, core/ingestion/threat_scoring.py for the threat levels, and services/daemon/beacon_sweep.py for the timer. Run the first on a conn.log and it prints the ranking. I tested the sweep against a slice of a real enterprise capture before opening the pull request, and it is open now: PR #5520. It is not in a Vigil release yet.
Vigil is Apache 2.0. Zeek’s connection log is documented in the Zeek manual.
I am adding this module. It is not in the release yet. Nobody paid me for this post.