A fire drill for your detections
A school does not wait for a real fire to find out whether the alarm works. It holds a drill, on a day it chooses, with everyone told what will happen.
Security teams do the same with attackers. They act out what a known group does, safely, and watch which alarms ring. In this lesson you plan such a drill for your own lab copy.
By the end of this lesson
Note
I can turn the techniques in a threat report into an emulation plan.
Key words
| Word | What it means |
|---|---|
| Adversary emulation | acting out a known group's behaviour to test defences |
| Emulation plan | the ordered steps and tests of one emulation |
| Red team | people who play the attacker |
| Purple team | attackers and defenders working side by side |
| Rules of engagement | what the testers may and may not do |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
3 questionsThe one rule
Important
Emulate only in your own lab copy. On a real network, every test needs written permission from whoever owns it, before it starts. Testing systems without authorisation is an offence under the Computer Misuse Act 1990. Copper Lantern, its report and the office are made up.
Emulation copies one known adversary
A penetration test looks for as many weaknesses as it can. A red team tries to reach a goal without being caught. Adversary emulation is narrower: it acts out the techniques one known group uses, in their order.
The question it answers is plain. If that group came here, which of its steps would we see? A purple team runs it with the defenders watching.
Worked example: four kinds of test
| Kind | Goal | Defenders told? | What you get |
|---|---|---|---|
| Penetration test | Find many weaknesses | Usually | A list of findings |
| Red team | Reach a goal unseen | No | Whether they were caught |
| Adversary emulation | Act out one group's techniques | Sometimes | Which steps were seen |
| Purple team | Test and fix together | Yes, they sit in | Detections fixed the same day |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
3 questionsA plan turns a report into steps
Northgate CERT's update says Copper Lantern reached a Linux file server too. There it asked who it was, read the system details, added a cron job, staged files in a hidden folder, deleted them and called home.
An emulation plan lists each step with its tactic, its ATT&CK technique and a harmless test that leaves the same evidence. The VM plays the file server, srv-files.
Move into the lab's folder and make emu
cd ~/detect && mkdir -p emuShown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the emulation plan, part 1
printf '%s\n' 'PLAN = [' ' ["1", "Discovery", "T1033", "System Owner/User Discovery", "A1", "process creation"],' ' ["2", "Discovery", "T1082", "System Information Discovery", "A2", "process creation"],' ' ["3", "Persistence", "T1053.003", "Scheduled Task/Job: Cron", "A3", "process creation"],' ' ["4", "Collection", "T1074.001", "Local Data Staging", "A4", "process creation"],' ' ["5", "Defense Evasion", "T1070.004", "File Deletion", "A5", "process creation"],' ' ["6", "Command and Control", "T1071.001", "Web Protocols", "A6", "web proxy log"],' ']' 'print("step tactic technique test evidence name")' 'for step, tactic, technique, name, test, evidence in PLAN:' ' print(step.ljust(4), tactic.ljust(19), technique.ljust(10), test.ljust(4), evidence.ljust(17), name)' 'tactics = sorted({row[1] for row in PLAN})' 'untested = [row[0] for row in PLAN if not row[4]]' > emu/plan.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the emulation plan, part 2
printf '%s\n' 'print("Tactics:", len(tactics), " Techniques:", len({row[2] for row in PLAN}), " Steps with no test:", len(untested))' >> emu/plan.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Print the plan
python3 emu/plan.pyShown 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 emulation means running the attacker's real tools. It does not. A defender needs the evidence a technique leaves, not the harm it does. So each test is a harmless stand-in that leaves the same traces, and real malware never comes near the network.
Rules of engagement come before any test
Before anything runs, the rules of engagement are agreed in writing. They name who authorised the test, the one target, the time window and what is allowed.
They also say when to stop, who to call and how everything is cleaned up afterwards. A test outside them is not a test; it is an attack.
Write the rules of engagement
printf '%s\n' 'Emulation of Copper Lantern, Linux stage, Riverside office' 'Authorised by: the head of IT, in writing, 16 November 2026' 'Target: srv-files, which is this lab VM, and nothing else' 'Window: 16 November 2026, 09:00 to 17:00' 'Allowed: the tests in emu/run.py and emu/pulse.py, harmless stand-ins only' 'Not allowed: real malware, other machines, the internet, changing real data' 'Stop if: anything breaks, or a real alert from another source fires' 'Contacts: the purple team lead and the on-call analyst' 'Cleanup: python3 emu/run.py clean, then check crontab -l is empty' > emu/scope.txtShown here, not run. Press Start lab to type it into your own lab’s terminal.
Read what is allowed and when to stop
grep -E "^(Target|Allowed|Not allowed|Stop if)" emu/scope.txtShown here, not run. Press Start lab to type it into your own lab’s terminal.
Check
Have a go
Check
3 questionsTry it: put the steps in tactic order
ORDER = ["Discovery", "Persistence", "Collection", "Defense Evasion", "Command and Control"]
plan = [("A6", "Command and Control"), ("A1", "Discovery"), ("A3", "Persistence")]
for test, tactic in sorted(plan, key=lambda step: ORDER.index(step[1])):
print(test, tactic)
# Add ("A4", "Collection") to the plan, then press Run.
Make a free account to save your work and track your progress.
Assignment: check an emulation plan
A plan is a list of steps. Each step is a dictionary with "step" (a number), "tactic", "technique" and "test".
valid_id(tid) returns True when tid is T and four digits, optionally followed by a dot and three digits, such as T1033 or T1053.003.
problems(plan) returns a list of strings in step order: "step N: bad id" for a step whose technique is not valid, then "step N: no test" for a step whose test is empty.
by_tactic(plan) returns a dictionary from each tactic to the sorted list of its distinct technique ids.
def valid_id(tid):
return False
def problems(plan):
return []
def by_tactic(plan):
return {}
Make a free account to save your work and track your progress.
Exit quiz
Have a go