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
| Word | What it means |
|---|---|
| Threat hunting | searching for attackers that no alert has found |
| Hypothesis | a testable guess about attacker activity |
| Dwell time | how long an attacker stays unnoticed |
| Visibility | whether your data can see an activity |
| Hunt record | the written plan and result of one hunt |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
3 questionsThe 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
| Part | Weak | Testable |
|---|---|---|
| Behaviour | Hackers are in | An Office program on a staff PC started a shell |
| Technique | None named | T1566.001, then T1059.001 |
| Data | The logs | Process creation events, logs/events.db |
| Scope | Everything | Every PC, 2 November |
| Proof | Anything odd | A 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 questionsMove into the lab's folder
cd ~/detectShown here, not run. Press Start lab to type it into your own lab’s terminal.
Make a folder for your hunts
mkdir -p huntShown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the hunt record
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.txtShown 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
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
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 questionsA 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
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
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.txtShown here, not run. Press Start lab to type it into your own lab’s terminal.
Try it: confirmed, refuted or inconclusive?
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.
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