One address, two colleges
Your office saw one machine calling 198.51.100.23. A week ago another college, in a report shared with you, saw the same address. Is it the same attacker? What else should you look for?
A simple four-cornered picture turns each sighting into a record you can join to others. The colleges and the attacker are made up, and you work in your own lab copy.
By the end of this lesson
Note
I can describe an intrusion event with the diamond model and pivot from one corner to find related events.
Key words
| Word | What it means | Example |
|---|---|---|
| Diamond model | an event described by four linked corners | |
| Adversary | who carries out the intrusion | |
| Capability | the tool or method used | |
| Infrastructure | what the capability travels through | 198.51.100.23 |
| Victim | the person, machine or organisation attacked | |
| Pivot | to search from one known value to related ones |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
3 questionsThe one rule
Important
Pivot only through data you hold: your own logs and reports shared with you. Looking an address up in a public record is fine. Connecting to it or scanning it is not, and without permission it can be an offence under the Computer Misuse Act 1990.
Every event has four corners
The diamond model (Caltagirone, Pendergast and Betz, 2013) records each step of an intrusion as an event with four corners. An adversary uses a capability over infrastructure against a victim.
Each event also carries a time, a phase and a result. A corner can be unknown, written ?. Most local events start with the adversary unknown.
Worked example: the office's command-and-control event
| Corner | Value | Where it came from |
|---|---|---|
| Adversary | ? | Nothing local names who |
| Capability | updater/1.4 | http.log, its user agent |
| Infrastructure | cdn-update.example, 198.51.100.23 | dns.log and conn.log |
| Victim | PC-15, 10.20.1.15 | conn.log and the office's asset list |
| Time and phase | 2026-11-02 09:00, command and control | The capture |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
3 questionsA pivot starts from one corner
To pivot is to take one known value and search for what else shares it. From the address, find the names that pointed to it. From the victim machine, find what else happened on it.
The Runs do both on the lab's own data. The office's asset list says PC-15 is 10.20.1.15, used by amira.
Move into the lab's folder
cd ~/detectShown here, not run. Press Start lab to type it into your own lab’s terminal.
Make the logs from the capture
zeek-lite -r pcaps/office.pcapShown here, not run. Press Start lab to type it into your own lab’s terminal.
Pivot from the address to its names
zeek-cut query answers < dns.log | grep 198.51.100.23 | sort | uniq -cShown here, not run. Press Start lab to type it into your own lab’s terminal.
Pivot from the victim to its events
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.
Check
Have a go
Check
3 questionsA common mistake
Warning
Many people think one shared corner proves one attacker. Addresses are rented, reused and shared, so a shared address is a lead, not a proof. Two events linked by several corners, here the address and an implant of the same family, make a stronger case.
Events join into threads and groups
Events on one victim, ordered by phase, form an activity thread: delivery, execution, discovery, command and control. Events on different victims that share corners can be grouped, which is how a report comes to name one adversary.
The script holds five events: four in the office and one from Hillside College's report.
Make sure the intelligence folder exists
mkdir -p intelShown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the diamond events, part 1
printf '%s\n' 'import sys' 'EVENTS = [' ' ["E1", "?", "delivery", "Copper Lantern", "invoice-0412.docx", "[email protected]", "[email protected]"],' ' ["E2", "2026-11-02 09:00", "command-and-control", "?", "updater/1.4", "cdn-update.example 198.51.100.23", "PC-15 10.20.1.15"],' ' ["E3", "2026-11-02 15:00", "execution", "?", "powershell -nop -w hidden -enc", "?", "PC-15 amira"],' ' ["E4", "2026-11-02 15:10", "discovery", "?", "whoami /all", "?", "PC-15 amira"],' ' ["E5", "2026-10-28 11:20", "command-and-control", "Copper Lantern", "updater/1.5", "198.51.100.23", "Hillside College"],' ']' 'NAMES = ["adversary", "capability", "infrastructure", "victim"]' 'want = sys.argv[1]' 'found = 0' 'for event in EVENTS:' ' if any(want in vertex for vertex in event[3:]):' ' found += 1' ' print(event[0], event[1], event[2])' ' for name, vertex in zip(NAMES, event[3:]):' ' print(" ", name.ljust(16), vertex)' > intel/diamond.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Write the diamond events, part 2
printf '%s\n' 'if found == 0:' ' print("No event has", want)' >> intel/diamond.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Pivot on the address
python3 intel/diamond.py 198.51.100.23Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Pivot on the user
python3 intel/diamond.py amiraShown here, not run. Press Start lab to type it into your own lab’s terminal.
Try it: which corners do two events share?
e2 = {"capability": "updater/1.4", "infrastructure": "198.51.100.23", "victim": "PC-15"}
e5 = {"capability": "updater/1.5", "infrastructure": "198.51.100.23", "victim": "Hillside College"}
for vertex in ["capability", "infrastructure", "victim"]:
if e2[vertex] == e5[vertex]:
print("E2 and E5 share their", vertex, e2[vertex])
# Change e5's capability to "updater/1.4", then press Run.
Make a free account to save your work and track your progress.
Assignment: pivot and build a thread
Each event is a dictionary with the keys id, phase, adversary, capability, infrastructure and victim. An unknown corner is "?".
pivot(events, value) returns the ids of the events where any of the four corners contains value, in the order given.
thread(events, victim, phases) returns the ids of the events whose victim contains victim, ordered by where their phase is in the list phases. Events with the same phase keep their order.
shared(a, b) returns the names of the corners where two events have the same value, leaving out "?", in the order adversary, capability, infrastructure, victim.
def pivot(events, value):
return []
def thread(events, victim, phases):
return []
def shared(a, b):
return []
Make a free account to save your work and track your progress.
Exit quiz
Have a go