Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Hunting for threats from a hypothesis

After this lesson: I can write a threat hunting hypothesis that data can confirm or refute.

60 min lesson7 commandsDetection engineering lab: Suricata rules, Sigma rules and Zeek-style logs on one private Ubuntu VM

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

A quiet week is not proof

Every alert at the Riverside office last week was closed. The rules from the threat report are in place and silent. The manager asks: are we clean?

Nobody can say yes from silence. A rule only finds what somebody thought of. In this lesson you go looking for what nobody thought of, in your own lab copy.

By the end of this lesson

Note

I can write a threat hunting hypothesis that data can confirm or refute.

Key words

WordWhat it means
Threat huntingsearching for attackers that no alert has found
Hypothesisa testable guess about attacker activity
Dwell timehow long an attacker stays unnoticed
Visibilitywhether your data can see an activity
Hunt recordthe written plan and result of one hunt

The cells students fill in are left blank in this preview.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

The one rule

Important

Hunt only in your own lab copy. Searching a real network's logs needs written permission from whoever owns it. Reading data you are not authorised to read is an offence under the Computer Misuse Act 1990. The office and its data are made up.

A hunter assumes a breach

A detection rule waits for a match. A threat hunt starts from the other end: assume an attacker is already inside, then go and look. Each hunt that finds one cuts its dwell time.

A hunt starts with a hypothesis: a guess precise enough that data can prove it wrong. Good sources are a threat report, an ATT&CK technique, or something odd in your own network.

Worked example: a weak and a testable hypothesis

PartWeakTestable
BehaviourHackers are inAn Office program on a staff PC started a shell
TechniqueNone namedT1566.001, then T1059.001
DataThe logsProcess creation events, logs/events.db
ScopeEverythingEvery PC, 2 November
ProofAnything oddA row with Word or Excel as parent and a shell as child

The cells students fill in are left blank in this preview.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Move into the lab's folder

Command
cd ~/detect

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Make a folder for your hunts

Command
mkdir -p hunt

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Write the hunt record

Command
printf '%s\n' 'Hunt H1, 10 November 2026' 'Hypothesis: an Office program on a staff PC has started a shell, as Copper Lantern does.' 'ATT&CK: T1566.001 then T1059.001' 'Data: process creation events in logs/events.db, 2 November' 'Scope: every PC in the table' 'Confirmed if: a row has WINWORD.EXE or EXCEL.EXE as parent and a shell as child' 'Refuted if: no such row, and every PC sent events all day' > hunt/h1.txt

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Check what you can see first

Silence only means something where you have visibility. So before the test, count each PC's events. A PC with almost none could hide anything.

Then run the test itself: every event whose parent is Word or Excel.

Count each PC's events

Command
sqlite3 logs/events.db "SELECT Computer, COUNT(*) FROM logs GROUP BY Computer"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Test the hypothesis

Command
sqlite3 logs/events.db "SELECT UtcTime, Computer, User, CommandLine FROM logs WHERE ParentImage LIKE '%WINWORD.EXE' OR ParentImage LIKE '%EXCEL.EXE'"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

A common mistake

Warning

Many people think a hunt that finds nothing has failed. If every machine in scope sent data, a refuted hypothesis is a result: it tells you where the attacker is not. Only missing data makes a hunt inconclusive, so write down which.

A hunt ends with a written outcome

One match is PC-15: Word started hidden, encoded PowerShell. That is a lead for incident response, so follow it a step. The other is PC-12, where Excel ran a script the finance team owns. It is benign, and written down so the next hunter skips it.

The hunt record keeps the plan, the result and the gaps. The PEAK framework calls this last step Act with Knowledge.

Follow the lead on PC-15

Command
sqlite3 logs/events.db "SELECT UtcTime, User, CommandLine FROM logs WHERE Computer = 'PC-15'"

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Write the outcome

Command
printf '%s\n' 'Outcome of H1: confirmed on PC-15, benign on PC-12' 'PC-15, 15:00: Word started hidden encoded PowerShell, then whoami. Passed to incident response.' 'PC-12, 15:30: Excel ran refresh-prices.ps1, which the finance team owns. Written down as known.' 'Gap: PC-15 sent only 2 events all day. Ask why its logging is thin.' 'Next: the same behaviour from any parent.' > hunt/h1-outcome.txt

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Try it: confirmed, refuted or inconclusive?

Code: python
hits = 0
hosts_seen = 6
hosts_in_scope = 6

if hits > 0:
    print("confirmed: pass the lead on")
elif hosts_seen < hosts_in_scope:
    print("inconclusive: some hosts sent no data")
else:
    print("refuted: write it down")
# Change hosts_seen to 5, then press Run.

Make a free account to save your work and track your progress.

Assignment: check a hypothesis and its verdict

A hypothesis is a dictionary that should hold five parts: "behaviour", "technique", "data", "scope" and "proof".

missing(h) returns the names of the parts that are absent or only spaces, in that order.

blind(seen, scope) returns the hosts in the set scope that are not in the set seen, sorted.

verdict(hits, seen, scope) returns "confirmed" if the list hits is not empty, "inconclusive" if any host in scope sent no data, and "refuted" otherwise.

Code: python
def missing(h):
    return []

def blind(seen, scope):
    return []

def verdict(hits, seen, scope):
    return "refuted"

Make a free account to save your work and track your progress.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.