Showing raw Markdown: the renderer could not load.
## Goal
You are the first responder at an invented company. Two log files show that something went wrong in the night. You find out which account was compromised, what the attacker did, how serious it is and what to do about it. Then you write a short incident report.
## Objectives
- Analyse authentication and web server logs to build a timeline of an incident.
- Classify and prioritise the incident by functional impact, information impact and recoverability.
- Choose containment, eradication and recovery actions, and say how to preserve evidence while doing so.
- Write a short incident report with root cause, impact and lessons learned.
## Prerequisites
- A terminal on Linux, macOS or Windows with WSL2 (Windows Subsystem for Linux), with `grep`, `awk`, `sed`, `sort` and `uniq`. They are installed by default. Check with `grep --version`.
- `sha256sum` for the evidence step. On macOS use `shasum -a 256` instead (the lab shows both).
- A text editor (`nano` is fine).
- The [Incident Response lesson](lesson.md) of this module. Skim at least the sections on triage, evidence and containment.
- No account, no network access, no installation. Cost: **free**.
- You don't need to know the tools in advance. Every command is ready to paste, and the lab explains each result in plain words.
> [!WARNING]
> **Everything here is made up.** The company (Harbor Light Books), the people, the server and the logs are invented. All addresses are from the documentation ranges reserved by RFC 5737 (`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`), which are never routable on the real Internet, and the names use `example.com`. Don't scan, test or log in to any real address. The techniques in this lab are defensive: you read logs that **you own**. Only ever investigate logs and systems you own or are explicitly authorised to examine.
## Architecture
<figure class="diagram" style="--dg-w: 1060px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1060 330" width="1060" height="330" role="img" aria-labelledby="ir-lab-architecture-title ir-lab-architecture-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="ir-lab-architecture-title">Lab scenario: two logs from one invented web server</title>
<desc id="ir-lab-architecture-desc">On the left, the Internet zone holds an attacker at 203.0.113.45 and ordinary staff and customers at 192.0.2.0/24 and 198.51.100.0/24. In the middle, the zone for the invented company Harbor Light Books shows the host web01.example.com running sshd on port 22, which writes auth.log, and a web app on port 443 with the shop and the /admin/ pages, which writes web.log. Arrows lead from the Internet to both services. On the right, your terminal zone shows the folder ~/ir-lab with copies of the two logs, analysed with grep, awk, sort and uniq; an arrow leads from each log file to it.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1059" height="329" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<g class="dg-l3"><rect class="dg-tint" x="20" y="20" width="270" height="290" rx="16" fill="#faf5f0" stroke="#e1ba9d" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(36 33) scale(0.7500)" fill="none" stroke="#b45309" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></g>
<text x="62" y="47" font-size="13" class="dg-ink" fill="#b45309" font-weight="700">Internet</text></g>
<g class="dg-l1"><rect class="dg-tint" x="330" y="20" width="400" height="290" rx="16" fill="#f0f6f9" stroke="#9ac3d9" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(346 33) scale(0.7500)" fill="none" stroke="#0369a1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z"/><path d="M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"/><path d="M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2"/><path d="M10 6h4"/><path d="M10 10h4"/><path d="M10 14h4"/><path d="M10 18h4"/></g>
<text x="372" y="47" font-size="13" class="dg-ink" fill="#0369a1" font-weight="700">Harbor Light Books (invented)</text></g>
<g class="dg-l2"><rect class="dg-tint" x="770" y="20" width="270" height="290" rx="16" fill="#f1f7f3" stroke="#a1ccb1" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(786 33) scale(0.7500)" fill="none" stroke="#15803d" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/></g>
<text x="812" y="47" font-size="13" class="dg-ink" fill="#15803d" font-weight="700">Your terminal</text></g>
<rect class="dg-card" x="40" y="62" width="230" height="86" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-warn"><g class="dg-icon" transform="translate(56 78) scale(1.2500)" fill="none" stroke="#b91c1c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></g></g>
<g class="dg-warn"><text x="98" y="99" font-size="15" class="dg-ink" fill="#b91c1c" font-weight="700">Attacker</text></g>
<text x="58" y="130" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">203.0.113.45</text>
<rect class="dg-card" x="40" y="180" width="230" height="100" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l3"><g class="dg-icon" transform="translate(56 196) scale(1.2500)" fill="none" stroke="#b45309" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="10" height="14" x="3" y="8" rx="2"/><path d="M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-2.4"/><path d="M8 18h.01"/></g></g>
<g class="dg-l3"><text x="98" y="217" font-size="15" class="dg-ink" fill="#b45309" font-weight="700">Staff and customers</text></g>
<text x="58" y="248" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">192.0.2.0/24</text>
<text x="58" y="268" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">198.51.100.0/24</text>
<text x="350" y="76" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="600" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">web01.example.com</text>
<rect class="dg-card" x="350" y="90" width="160" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l4"><g class="dg-icon" transform="translate(366 106) scale(1.2500)" fill="none" stroke="#c2410c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></g></g>
<g class="dg-l4"><text x="408" y="127" font-size="15" class="dg-ink" fill="#c2410c" font-weight="700">sshd</text></g>
<text x="368" y="158" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">port 22: remote logins</text>
<rect class="dg-card" x="550" y="90" width="160" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l5"><g class="dg-icon" transform="translate(566 106) scale(1.2500)" fill="none" stroke="#be185d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></g></g>
<g class="dg-l5"><text x="608" y="127" font-size="14" class="dg-ink" fill="#be185d" font-weight="700">auth.log</text></g>
<text x="568" y="158" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">who logged in over SSH</text>
<g class="dg-l4"><path class="dg-stroke" d="M512 135H546" stroke="#c2410c" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l4"><path class="dg-stroke" d="M539 129l8 6-8 6" stroke="#c2410c" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-warn"><path class="dg-stroke" d="M272 135H346" stroke="#b91c1c" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="7 6"/></g>
<g class="dg-warn"><path class="dg-stroke" d="M339 129l8 6-8 6" stroke="#b91c1c" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="350" y="200" width="160" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(366 216) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></g></g>
<g class="dg-l1"><text x="408" y="237" font-size="15" class="dg-ink" fill="#0369a1" font-weight="700">Web app</text></g>
<text x="368" y="268" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">port 443: shop and /admin/</text>
<rect class="dg-card" x="550" y="200" width="160" height="90" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l5"><g class="dg-icon" transform="translate(566 216) scale(1.2500)" fill="none" stroke="#be185d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></g></g>
<g class="dg-l5"><text x="608" y="237" font-size="14" class="dg-ink" fill="#be185d" font-weight="700">web.log</text></g>
<text x="568" y="268" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">who requested what</text>
<g class="dg-l1"><path class="dg-stroke" d="M512 245H546" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M539 239l8 6-8 6" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l3"><path class="dg-stroke" d="M272 245H346" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="7 6"/></g>
<g class="dg-l3"><path class="dg-stroke" d="M339 239l8 6-8 6" stroke="#b45309" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="790" y="100" width="230" height="180" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(806 116) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/></g></g>
<g class="dg-l2"><text x="848" y="137" font-size="15" class="dg-ink" fill="#15803d" font-weight="700">~/ir-lab</text></g>
<text x="808" y="168" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">copies of auth.log and web.log</text>
<text x="808" y="188" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">analysed with grep, awk,</text>
<text x="808" y="208" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">sort and uniq</text>
<g class="dg-l2"><path class="dg-stroke" d="M712 135H782" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><path class="dg-stroke" d="M777 129l8 6-8 6" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><path class="dg-stroke" d="M712 245H782" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><path class="dg-stroke" d="M777 239l8 6-8 6" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
</svg></figure>
*Figure 1. One server, two logs: `auth.log` records SSH logins and `web.log` records web requests. You only work with the copies in `~/ir-lab`.*
**About the logs.** Both files are in UTC (Coordinated Universal Time), so their times line up. In this invented company, staff use the same username and password for SSH and for the `/admin/` web pages. The web server asks for that password (HTTP basic authentication) and writes the username in the third field of each line. That reuse is convenient, and, as you will see, it also helps the attacker.
## Steps
### Step 1 — Create the workspace and the two log files (7 min)
In a real incident you would copy the logs from the server. Here you create them yourself. First make a folder:
```bash
mkdir -p ~/ir-lab
cd ~/ir-lab
pwd
```
Expected output (your user name will differ):
```text
/home/<your-user>/ir-lab
```
`mkdir -p` creates the folder (and doesn't complain if it exists), `cd` moves into it, and `pwd` prints where you are. Every later step starts here.
Now create the SSH log. Copy the **whole** block, from `cat` to the final `EOF`, and paste it in the terminal. The quotes around `'EOF'` matter: they stop the shell from changing any characters.
```bash
cat > auth.log <<'EOF'
Nov 3 17:42:10 web01 sshd[2012]: Accepted password for alice from 192.0.2.10 port 50611 ssh2
Nov 3 17:58:31 web01 sshd[2018]: Accepted password for bob from 192.0.2.22 port 52937 ssh2
Nov 3 18:05:44 web01 sshd[2055]: Failed password for carol from 198.51.100.7 port 42373 ssh2
Nov 3 18:05:52 web01 sshd[2081]: Accepted password for carol from 198.51.100.7 port 43084 ssh2
Nov 3 19:12:09 web01 sshd[2087]: Accepted password for dave from 192.0.2.50 port 59096 ssh2
Nov 3 22:30:15 web01 sshd[2103]: Failed password for erin from 192.0.2.77 port 56627 ssh2
Nov 3 22:30:21 web01 sshd[2111]: Failed password for erin from 192.0.2.77 port 41228 ssh2
Nov 3 22:30:29 web01 sshd[2140]: Accepted password for erin from 192.0.2.77 port 54209 ssh2
Nov 4 02:11:05 web01 sshd[2148]: Invalid user admin from 203.0.113.45 port 47886
Nov 4 02:11:05 web01 sshd[2186]: Failed password for invalid user admin from 203.0.113.45 port 47886 ssh2
Nov 4 02:11:07 web01 sshd[2225]: Invalid user test from 203.0.113.45 port 41936
Nov 4 02:11:07 web01 sshd[2235]: Failed password for invalid user test from 203.0.113.45 port 41936 ssh2
Nov 4 02:11:08 web01 sshd[2275]: Invalid user oracle from 203.0.113.45 port 60664
Nov 4 02:11:08 web01 sshd[2281]: Failed password for invalid user oracle from 203.0.113.45 port 60664 ssh2
Nov 4 02:11:11 web01 sshd[2309]: Failed password for alice from 203.0.113.45 port 59187 ssh2
Nov 4 02:11:12 web01 sshd[2314]: Failed password for bob from 203.0.113.45 port 47244 ssh2
Nov 4 02:11:15 web01 sshd[2335]: Failed password for carol from 203.0.113.45 port 44363 ssh2
Nov 4 02:11:17 web01 sshd[2372]: Failed password for dave from 203.0.113.45 port 44726 ssh2
Nov 4 02:11:18 web01 sshd[2394]: Failed password for erin from 203.0.113.45 port 58707 ssh2
Nov 4 02:12:43 web01 sshd[2403]: Invalid user admin from 203.0.113.45 port 45922
Nov 4 02:12:43 web01 sshd[2443]: Failed password for invalid user admin from 203.0.113.45 port 45922 ssh2
Nov 4 02:12:46 web01 sshd[2458]: Invalid user test from 203.0.113.45 port 60935
Nov 4 02:12:46 web01 sshd[2484]: Failed password for invalid user test from 203.0.113.45 port 60935 ssh2
Nov 4 02:12:47 web01 sshd[2491]: Invalid user oracle from 203.0.113.45 port 57948
Nov 4 02:12:47 web01 sshd[2530]: Failed password for invalid user oracle from 203.0.113.45 port 57948 ssh2
Nov 4 02:12:48 web01 sshd[2546]: Failed password for alice from 203.0.113.45 port 60283 ssh2
Nov 4 02:12:50 web01 sshd[2576]: Failed password for bob from 203.0.113.45 port 57423 ssh2
Nov 4 02:12:52 web01 sshd[2616]: Failed password for carol from 203.0.113.45 port 55256 ssh2
Nov 4 02:12:54 web01 sshd[2638]: Failed password for dave from 203.0.113.45 port 51848 ssh2
Nov 4 02:12:55 web01 sshd[2656]: Failed password for erin from 203.0.113.45 port 45890 ssh2
Nov 4 02:14:16 web01 sshd[2678]: Invalid user admin from 203.0.113.45 port 58822
Nov 4 02:14:16 web01 sshd[2714]: Failed password for invalid user admin from 203.0.113.45 port 58822 ssh2
Nov 4 02:14:18 web01 sshd[2745]: Invalid user test from 203.0.113.45 port 51255
Nov 4 02:14:18 web01 sshd[2766]: Failed password for invalid user test from 203.0.113.45 port 51255 ssh2
Nov 4 02:14:21 web01 sshd[2776]: Invalid user oracle from 203.0.113.45 port 42398
Nov 4 02:14:21 web01 sshd[2811]: Failed password for invalid user oracle from 203.0.113.45 port 42398 ssh2
Nov 4 02:14:23 web01 sshd[2835]: Failed password for alice from 203.0.113.45 port 45405 ssh2
Nov 4 02:14:24 web01 sshd[2864]: Failed password for bob from 203.0.113.45 port 56022 ssh2
Nov 4 02:14:25 web01 sshd[2902]: Failed password for carol from 203.0.113.45 port 42543 ssh2
Nov 4 02:14:28 web01 sshd[2926]: Accepted password for dave from 203.0.113.45 port 50280 ssh2
Nov 4 02:14:31 web01 sshd[2960]: Failed password for erin from 203.0.113.45 port 51474 ssh2
Nov 4 02:41:18 web01 sshd[3000]: Disconnected from user dave 203.0.113.45 port 50280
Nov 4 05:20:11 web01 sshd[3007]: Invalid user ubuntu from 198.51.100.99 port 54948
Nov 4 05:20:11 web01 sshd[3015]: Failed password for invalid user ubuntu from 198.51.100.99 port 54948 ssh2
Nov 4 05:20:19 web01 sshd[3048]: Invalid user ubuntu from 198.51.100.99 port 48845
Nov 4 05:20:19 web01 sshd[3055]: Failed password for invalid user ubuntu from 198.51.100.99 port 48845 ssh2
Nov 4 07:58:20 web01 sshd[3077]: Accepted password for alice from 192.0.2.10 port 41988 ssh2
Nov 4 08:52:41 web01 sshd[3108]: Accepted password for dave from 192.0.2.50 port 58938 ssh2
Nov 4 09:15:03 web01 sshd[3135]: Failed password for bob from 192.0.2.22 port 49325 ssh2
Nov 4 09:15:12 web01 sshd[3139]: Accepted password for bob from 192.0.2.22 port 51370 ssh2
EOF
```
Next, the web server log, in the "combined log format" used by many web servers:
```bash
cat > web.log <<'EOF'
198.51.100.23 - - [03/Nov/2026:17:45:02 +0000] "GET / HTTP/1.1" 200 5120 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.23 - - [03/Nov/2026:17:45:03 +0000] "GET /products HTTP/1.1" 200 18733 "https://www.example.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.23 - - [03/Nov/2026:17:46:40 +0000] "GET /products/42 HTTP/1.1" 200 9402 "https://www.example.com/products" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
192.0.2.10 - alice [03/Nov/2026:18:20:15 +0000] "GET /admin/ HTTP/1.1" 200 3310 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
192.0.2.10 - alice [03/Nov/2026:18:20:31 +0000] "GET /admin/orders HTTP/1.1" 200 22450 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
192.0.2.50 - dave [03/Nov/2026:19:14:50 +0000] "GET /admin/ HTTP/1.1" 200 3310 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
192.0.2.50 - dave [03/Nov/2026:19:15:20 +0000] "GET /admin/orders HTTP/1.1" 200 22988 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
198.51.100.7 - - [03/Nov/2026:20:03:11 +0000] "GET / HTTP/1.1" 200 5120 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"
198.51.100.7 - - [03/Nov/2026:21:30:44 +0000] "POST /cart/add HTTP/1.1" 302 0 "https://www.example.com/products/42" "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"
198.51.100.31 - - [03/Nov/2026:22:41:07 +0000] "GET /products/9 HTTP/1.1" 200 9017 "https://www.example.com/products" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.23 - - [03/Nov/2026:23:05:52 +0000] "GET /cart HTTP/1.1" 200 2210 "https://www.example.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.31 - - [04/Nov/2026:00:12:09 +0000] "GET /products HTTP/1.1" 200 18733 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.31 - - [04/Nov/2026:01:15:20 +0000] "GET /about HTTP/1.1" 200 4012 "https://www.example.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.31 - - [04/Nov/2026:01:47:55 +0000] "GET /products/17 HTTP/1.1" 200 9120 "https://www.example.com/products" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
203.0.113.45 - - [04/Nov/2026:02:17:30 +0000] "GET /.env HTTP/1.1" 404 196 "-" "curl/7.88.1"
203.0.113.45 - - [04/Nov/2026:02:17:31 +0000] "GET /wp-login.php HTTP/1.1" 404 196 "-" "curl/7.88.1"
203.0.113.45 - - [04/Nov/2026:02:17:33 +0000] "GET /phpmyadmin/ HTTP/1.1" 404 196 "-" "curl/7.88.1"
203.0.113.45 - - [04/Nov/2026:02:18:40 +0000] "GET /admin/ HTTP/1.1" 401 381 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:19:05 +0000] "GET /admin/ HTTP/1.1" 200 3310 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:19:20 +0000] "GET /admin/users HTTP/1.1" 200 6021 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:20:33 +0000] "GET /admin/export/customers.csv HTTP/1.1" 200 4812034 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:21:10 +0000] "GET /admin/orders HTTP/1.1" 200 22790 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:23:45 +0000] "POST /admin/users/new HTTP/1.1" 302 0 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:24:02 +0000] "GET /admin/users HTTP/1.1" 200 6188 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:31:50 +0000] "GET /admin/export/orders.csv HTTP/1.1" 200 1930466 "-" "curl/7.88.1"
203.0.113.45 - dave [04/Nov/2026:02:38:12 +0000] "GET /admin/settings HTTP/1.1" 200 4417 "-" "curl/7.88.1"
198.51.100.23 - - [04/Nov/2026:03:02:18 +0000] "GET /products/42 HTTP/1.1" 200 9402 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.23 - - [04/Nov/2026:04:33:27 +0000] "GET /products HTTP/1.1" 200 18733 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.99 - - [04/Nov/2026:05:20:40 +0000] "GET / HTTP/1.1" 200 5120 "-" "Mozilla/5.0 (compatible; scanner)"
198.51.100.31 - - [04/Nov/2026:06:41:09 +0000] "GET /cart HTTP/1.1" 200 2210 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
198.51.100.31 - - [04/Nov/2026:07:12:44 +0000] "GET /products/42 HTTP/1.1" 200 9402 "https://www.example.com/products" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
192.0.2.10 - alice [04/Nov/2026:07:59:12 +0000] "GET /admin/ HTTP/1.1" 200 3310 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
198.51.100.7 - - [04/Nov/2026:08:30:45 +0000] "GET /products HTTP/1.1" 200 18733 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"
192.0.2.50 - dave [04/Nov/2026:08:55:03 +0000] "GET /admin/ HTTP/1.1" 200 3310 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
192.0.2.50 - dave [04/Nov/2026:08:55:30 +0000] "GET /admin/orders HTTP/1.1" 200 23105 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
192.0.2.77 - - [04/Nov/2026:09:10:01 +0000] "GET /admin/ HTTP/1.1" 401 381 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
192.0.2.77 - erin [04/Nov/2026:09:10:09 +0000] "GET /admin/ HTTP/1.1" 200 3310 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"
198.51.100.23 - - [04/Nov/2026:09:12:44 +0000] "POST /cart/add HTTP/1.1" 302 0 "https://www.example.com/products/42" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
EOF
```
Check that the files are complete by counting their lines:
```bash
wc -l auth.log web.log
```
Expected output:
```text
50 auth.log
38 web.log
88 total
```
`wc -l` counts lines. If your numbers differ, a paste went wrong: delete the file with `rm auth.log` (or `rm web.log`) and paste it again.
Take a first look at one line of each file:
```bash
head -n 1 auth.log
head -n 1 web.log
```
Expected output:
```text
Nov 3 17:42:10 web01 sshd[2012]: Accepted password for alice from 192.0.2.10 port 50611 ssh2
198.51.100.23 - - [03/Nov/2026:17:45:02 +0000] "GET / HTTP/1.1" 200 5120 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
```
How to read them:
- **`auth.log`:** date and time, the host (`web01`), the program (`sshd`, the SSH server) and a message. `Accepted password for alice from 192.0.2.10` means that `alice` logged in with her password from that address. `Failed password` means a wrong password. `Invalid user` means the name doesn't exist on the server.
- **`web.log`:** address, a dash, the **username** (`-` means "not logged in"), the time in brackets, the request in quotes (`GET / HTTP/1.1` is the method, the page and the protocol), the **status code** (`200` OK, `302` redirect, `401` login required, `404` not found), the **bytes** sent, the referring page and the browser or tool name.
### Step 2 — Preserve the evidence before you touch anything (4 min)
Good habit number one: before you analyse, save an untouched copy and write down its fingerprint (a **hash**). If anyone later doubts the copy, the fingerprint proves it hasn't changed. You'll do this on the **logs**, the evidence you have.
```bash
mkdir -p evidence
cp -p auth.log web.log evidence/
sha256sum evidence/auth.log evidence/web.log | tee evidence/SHA256SUMS
chmod a-w evidence/*
```
On macOS, use `shasum -a 256` in place of `sha256sum` (in this step and the next).
Expected output (the hashes are the same only if you pasted the logs exactly as shown):
```text
dfe4d86bd5c3efcebf6da2358834f0a1e938b8669a7c5064b8e90d210c368ce2 evidence/auth.log
8085aadf6b08696521f310a85f242a670dc2f4bb1999301cc97b95aa2b45afb9 evidence/web.log
```
What each command did: `cp -p` copied the files and kept their timestamps; `sha256sum` computed a 64-character fingerprint of each file; `tee` showed it **and** saved it in `evidence/SHA256SUMS`; `chmod a-w` made the copies read-only, so you can't change them by accident.
Prove the copies are intact:
```bash
sha256sum -c evidence/SHA256SUMS
```
Expected output:
```text
evidence/auth.log: OK
evidence/web.log: OK
```
`OK` means the file matches its saved fingerprint. If a single character were changed, you would see `FAILED`. In a real case you would also note who made the copy, when and where it is stored: that is the chain of custody. From now on, analyse the files in `~/ir-lab`, never the ones in `evidence/`.
### Step 3 — Count the failed logins per address (6 min)
Question: *is anyone guessing passwords?* Count the `Failed password` lines for each source address. Read the command from left to right; each `|` (pipe) hands the output of one tool to the next:
```bash
grep 'Failed password' auth.log | grep -oE 'from [0-9.]+' | awk '{print $2}' | sort | uniq -c | sort -rn
```
Expected output:
```text
23 203.0.113.45
2 198.51.100.99
2 192.0.2.77
1 198.51.100.7
1 192.0.2.22
```
What each part does:
| Part | What it does |
|---|---|
| `grep 'Failed password' auth.log` | Keeps only the lines about wrong passwords |
| `grep -oE 'from [0-9.]+'` | Prints only the matching piece: the word `from` and the address after it |
| `awk '{print $2}'` | Prints the second word of each line, which is the address |
| `sort` | Puts equal addresses next to each other (needed by the next tool) |
| `uniq -c` | Collapses repeats and puts the count in front |
| `sort -rn` | Sorts numerically, biggest first |
**Reading the result.** The address `203.0.113.45` has 23 failures: far more than anyone else. The others have one or two: typos by people who then succeed (you will confirm that later). One address stands out, so `203.0.113.45` is your **suspect address**.
### Step 4 — Which accounts did the suspect try? (5 min)
Now see which names that address tried:
```bash
grep 'Failed password' auth.log | grep '203.0.113.45' | grep -oE 'for (invalid user )?[a-z]+' | sed 's/for //; s/invalid user //' | sort | uniq -c | sort -rn
```
Expected output:
```text
3 test
3 oracle
3 erin
3 carol
3 bob
3 alice
3 admin
2 dave
```
The new tool is `sed 's/for //; s/invalid user //'`: it deletes the words `for ` and `invalid user ` so only the name remains.
**Reading the result.** Eight different names, each tried three times (`dave` only twice: his third attempt did not fail, which you will see in the next step). Three of the names (`admin`, `test`, `oracle`) are common guesses. Check which ones don't exist on the server:
```bash
grep 'Invalid user' auth.log | grep '203.0.113.45' | awk '{print $8}' | sort -u
```
Expected output:
```text
admin
oracle
test
```
`Invalid user` lines are written only for names that don't exist, so those three are guesses. The other five (`alice`, `bob`, `carol`, `dave`, `erin`) are real staff accounts. The attacker knows, or guessed, real user names. Few attempts per account and many accounts is the pattern of **password spraying**: it avoids locking any single account. A quick look at the times shows three rounds, at 02:11, 02:12 and 02:14.
### Step 5 — Did a guess work? (5 min)
Question: *did the suspect get in?* Search for successful logins from that address:
```bash
grep 'Accepted' auth.log | grep '203.0.113.45'
```
Expected output:
```text
Nov 4 02:14:28 web01 sshd[2926]: Accepted password for dave from 203.0.113.45 port 50280 ssh2
```
**This is the key line.** At 02:14:28 on 4 November, the account `dave` logged in from the suspect address. Note that `dave` had only two failures: the third try succeeded. The attacker got in on the third round.
Is it possible that Dave himself logged in from a new place? Compare with his usual behaviour:
```bash
grep 'Accepted password for dave' auth.log
```
Expected output:
```text
Nov 3 19:12:09 web01 sshd[2087]: Accepted password for dave from 192.0.2.50 port 59096 ssh2
Nov 4 02:14:28 web01 sshd[2926]: Accepted password for dave from 203.0.113.45 port 50280 ssh2
Nov 4 08:52:41 web01 sshd[3108]: Accepted password for dave from 192.0.2.50 port 58938 ssh2
```
Dave normally logs in from `192.0.2.50`. The 02:14 login is from the address that had just failed 22 times, mostly against other accounts, in the middle of the night: that is not Dave. (You can also see all accepted logins per user and address with `grep 'Accepted' auth.log | awk '{print $9, $11}' | sort | uniq -c`.)
When did that session end?
```bash
grep '203.0.113.45' auth.log | tail -n 1
```
Expected output:
```text
Nov 4 02:41:18 web01 sshd[3000]: Disconnected from user dave 203.0.113.45 port 50280
```
The port number (`50280`) is the same as in the login line, so this is the end of the same session: it lasted about 27 minutes (02:14:28 to 02:41:18).
> [!NOTE]
> `auth.log` tells you the attacker logged in and for how long. It does **not** tell you what they typed in that SSH session. For that you would need other evidence: shell history, `auditd` records or EDR data. Always note what your logs *cannot* show.
### Step 6 — What did the attacker do on the web server? (7 min)
The same address appears in `web.log`. List its requests, showing only the useful columns (time, user, method, page, status, bytes):
```bash
grep '203.0.113.45' web.log | awk '{print substr($4,2), $3, substr($6,2), $7, $9, $10}'
```
Expected output:
```text
04/Nov/2026:02:17:30 - GET /.env 404 196
04/Nov/2026:02:17:31 - GET /wp-login.php 404 196
04/Nov/2026:02:17:33 - GET /phpmyadmin/ 404 196
04/Nov/2026:02:18:40 - GET /admin/ 401 381
04/Nov/2026:02:19:05 dave GET /admin/ 200 3310
04/Nov/2026:02:19:20 dave GET /admin/users 200 6021
04/Nov/2026:02:20:33 dave GET /admin/export/customers.csv 200 4812034
04/Nov/2026:02:21:10 dave GET /admin/orders 200 22790
04/Nov/2026:02:23:45 dave POST /admin/users/new 302 0
04/Nov/2026:02:24:02 dave GET /admin/users 200 6188
04/Nov/2026:02:31:50 dave GET /admin/export/orders.csv 200 1930466
04/Nov/2026:02:38:12 dave GET /admin/settings 200 4417
```
`substr($4,2)` removes the `[` in front of the time and `substr($6,2)` removes the opening quote of the request. Read the story:
- **02:17:30 to 02:17:33.** Three requests for pages that don't exist (`404`): `/.env`, `/wp-login.php`, `/phpmyadmin/`. These are the usual files an attacker looks for. The attacker is feeling around.
- **02:18:40.** `/admin/` returns `401`: it wants a password.
- **02:19:05.** `/admin/` returns `200` and the user is **`dave`**. The attacker reused Dave's stolen password on the web pages.
- **02:20:33.** `GET /admin/export/customers.csv`, `200`, **4,812,034 bytes**: the customer list was downloaded.
- **02:23:45.** `POST /admin/users/new`, `302`: a form was submitted to create something, and the redirect (`302`) is typical of success. This may be a **new account**, a way back in later.
- **02:31:50.** `orders.csv`, 1,930,466 bytes: the order history was downloaded too.
Find the large downloads without reading every line:
```bash
awk '$10 > 1000000 {print $1, $3, $7, $10}' web.log
```
Expected output:
```text
203.0.113.45 dave /admin/export/customers.csv 4812034
203.0.113.45 dave /admin/export/orders.csv 1930466
```
`awk '$10 > 1000000'` keeps the lines where the 10th field (the bytes) is above one million. Only the attacker's two exports qualify. Add them up to see how much data left:
```bash
awk '$1=="203.0.113.45" {s+=$10} END {printf "%d bytes\n", s}' web.log
```
Expected output:
```text
6786195 bytes
```
That is about 6.8 MB sent to the attacker's address (the total includes the small pages as well, but the two exports are nearly all of it).
Finally, see if anything similar came from anyone else. Check who else used `/admin/`:
```bash
awk '$7 ~ /^\/admin/ && $1 != "203.0.113.45" {print $1, $3}' web.log | sort | uniq -c
```
Expected output:
```text
3 192.0.2.10 alice
4 192.0.2.50 dave
1 192.0.2.77 -
1 192.0.2.77 erin
```
Everyone else uses their usual addresses (the lone `-` is `erin`'s browser asking for the page before sending her password). Nothing else looks wrong.
> [!NOTE]
> A web access log records the **request line**, not the form data. You can see that `POST /admin/users/new` returned `302`, but not *which* account was created. You would look in the application itself (its user list and its own audit trail) to find out.
### Step 7 — Build the timeline (8 min)
A timeline puts events from different logs in one list, in time order. Open a file and write the key events, one per line, with the time, the source log and what happened:
```bash
nano timeline.txt
```
Use the results of steps 3 to 6. A good timeline needs about eight lines. Try it before looking at the answer.
<details>
<summary>Show a model timeline</summary>
All times 4 November 2026, UTC. The two lanes (SSH from `auth.log`, WEB from `web.log`) are merged in time order.
<figure class="diagram" style="--dg-w: 960px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 960 538" width="960" height="538" role="img" aria-labelledby="ir-lab-timeline-title ir-lab-timeline-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="ir-lab-timeline-title">Incident timeline from the lab logs</title>
<desc id="ir-lab-timeline-desc">A vertical timeline of eight events on 4 November 2026 (UTC), all from 203.0.113.45. At 02:11:05, in auth.log, password spraying starts: 23 failed logins in 3 rounds across 8 names. At 02:14:28, in auth.log, a login for dave is accepted. At 02:17:30, in web.log, probes for /.env, /wp-login.php and /phpmyadmin/ return 404. At 02:19:05, in web.log, /admin/ opens as dave with status 200. At 02:20:33, in web.log, customers.csv is downloaded: 4,812,034 bytes. At 02:23:45, in web.log, a POST to /admin/users/new returns 302, possibly a new account. At 02:31:50, in web.log, orders.csv is downloaded: 1,930,466 bytes. At 02:41:18, in auth.log, the SSH session of dave ends.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="959" height="537" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<text x="24" y="36" font-size="11" class="dg-muted" fill="#5c5c68" font-weight="700" letter-spacing="1.2">4 NOVEMBER 2026 (UTC) - ALL EVENTS FROM 203.0.113.45</text>
<path class="dg-line" d="M151 83V489" stroke="#cfcfc8" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
<rect class="dg-card" x="24" y="58" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="87.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:11:05</text>
<g class="dg-l4"><circle class="dg-solid" cx="151" cy="83" r="7" fill="#c2410c"/></g>
<g class="dg-l4"><rect class="dg-solid" x="180" y="70" width="56" height="26" rx="13" fill="#c2410c"/><text x="208" y="87.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">SSH</text></g>
<text x="252" y="87.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">Password spraying starts: 23 failed logins in 3 rounds across 8 names</text>
<text x="920" y="87.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">auth.log</text>
<rect class="dg-card" x="24" y="116" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="145.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:14:28</text>
<g class="dg-l4"><circle class="dg-solid" cx="151" cy="141" r="7" fill="#c2410c"/></g>
<g class="dg-l4"><rect class="dg-solid" x="180" y="128" width="56" height="26" rx="13" fill="#c2410c"/><text x="208" y="145.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">SSH</text></g>
<text x="252" y="145.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">Login for dave accepted from 203.0.113.45</text>
<text x="920" y="145.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">auth.log</text>
<rect class="dg-card" x="24" y="174" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="203.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:17:30</text>
<g class="dg-l1"><circle class="dg-solid" cx="151" cy="199" r="7" fill="#0369a1"/></g>
<g class="dg-l1"><rect class="dg-solid" x="180" y="186" width="56" height="26" rx="13" fill="#0369a1"/><text x="208" y="203.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">WEB</text></g>
<text x="252" y="203.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">Probes for /.env, /wp-login.php, /phpmyadmin/ (404)</text>
<text x="920" y="203.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">web.log</text>
<rect class="dg-card" x="24" y="232" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="261.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:19:05</text>
<g class="dg-l1"><circle class="dg-solid" cx="151" cy="257" r="7" fill="#0369a1"/></g>
<g class="dg-l1"><rect class="dg-solid" x="180" y="244" width="56" height="26" rx="13" fill="#0369a1"/><text x="208" y="261.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">WEB</text></g>
<text x="252" y="261.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">/admin/ opens as dave (200)</text>
<text x="920" y="261.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">web.log</text>
<rect class="dg-card" x="24" y="290" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="319.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:20:33</text>
<g class="dg-l1"><circle class="dg-solid" cx="151" cy="315" r="7" fill="#0369a1"/></g>
<g class="dg-l1"><rect class="dg-solid" x="180" y="302" width="56" height="26" rx="13" fill="#0369a1"/><text x="208" y="319.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">WEB</text></g>
<text x="252" y="319.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">Downloads customers.csv: 4,812,034 bytes</text>
<text x="920" y="319.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">web.log</text>
<rect class="dg-card" x="24" y="348" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="377.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:23:45</text>
<g class="dg-l1"><circle class="dg-solid" cx="151" cy="373" r="7" fill="#0369a1"/></g>
<g class="dg-l1"><rect class="dg-solid" x="180" y="360" width="56" height="26" rx="13" fill="#0369a1"/><text x="208" y="377.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">WEB</text></g>
<text x="252" y="377.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">POST /admin/users/new (302): a new account?</text>
<text x="920" y="377.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">web.log</text>
<rect class="dg-card" x="24" y="406" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="435.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:31:50</text>
<g class="dg-l1"><circle class="dg-solid" cx="151" cy="431" r="7" fill="#0369a1"/></g>
<g class="dg-l1"><rect class="dg-solid" x="180" y="418" width="56" height="26" rx="13" fill="#0369a1"/><text x="208" y="435.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">WEB</text></g>
<text x="252" y="435.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">Downloads orders.csv: 1,930,466 bytes</text>
<text x="920" y="435.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">web.log</text>
<rect class="dg-card" x="24" y="464" width="912" height="50" rx="10" fill="#ffffff" stroke="#cfcfc8"/>
<text x="40" y="493.5" font-size="13.5" class="dg-text" fill="#17171c" font-weight="700" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">02:41:18</text>
<g class="dg-l4"><circle class="dg-solid" cx="151" cy="489" r="7" fill="#c2410c"/></g>
<g class="dg-l4"><rect class="dg-solid" x="180" y="476" width="56" height="26" rx="13" fill="#c2410c"/><text x="208" y="493.5" font-size="11.5" class="dg-on" fill="#ffffff" font-weight="700" text-anchor="middle">SSH</text></g>
<text x="252" y="493.5" font-size="13" class="dg-text" fill="#17171c" font-weight="500">SSH session of dave ends</text>
<text x="920" y="493.5" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="end" font-family="JetBrains Mono, ui-monospace, Menlo, Consolas, monospace">auth.log</text>
</svg></figure>
*Figure 2. The whole incident lasted 30 minutes. Source: the two logs. The first event (02:11:05) is the start of the spraying; the last (02:41:18) is the end of the SSH session.*
Things to notice:
- The attacker moved from guessing passwords to using one in **3 minutes and 23 seconds** (02:11:05 to 02:14:28).
- The web activity (02:17 to 02:38) happened *during* the SSH session (02:14 to 02:41), so the attacker was in two places at once.
- **What we don't know:** what they did in the SSH session, and whether the account created at 02:23:45 exists.
- **What we know was lost:** at least two files with customer and order data.
</details>
### Step 8 — Classify and prioritise (5 min)
Use the three factors from the lesson (the categories are from NIST SP 800-61r2). Decide each, with a reason. Remember: the shop was never down.
1. **Functional impact:** None, Low, Medium or High?
2. **Information impact:** None, Privacy breach, Proprietary breach or Integrity loss?
3. **Recoverability:** Regular, Supplemented, Extended or Not recoverable?
4. **Priority:** low, medium or high, and does it need anyone outside IT to be told?
<details>
<summary>Show the answers</summary>
| Factor | Category | Reason |
|---|---|---|
| Functional impact | **None** | The website and SSH kept working; no downtime was reported. |
| Information impact | **Privacy breach** (and possibly proprietary) | `customers.csv` very likely holds personal data, and `orders.csv` holds business data. You'd confirm by opening the export function's output, but assume personal data until proven otherwise. A new account (if real) is also a possible integrity problem. |
| Recoverability | **Not recoverable** for the stolen data; **Regular** for the system | You can reset the account and remove the new user with the team and tools you have. You can't make the attacker forget the files. |
| Priority | **High** | Functional impact alone would say "low", which is the trap. Stolen customer data is serious. |
Who to tell: the incident manager and management now, and the person responsible for privacy or legal advice **immediately**. If the customers are in the EU, a personal data breach may have to be notified to the data protection authority within 72 hours of the company becoming aware of it (GDPR Article 33). Whether it applies is a legal judgement, which the privacy officer or legal counsel makes with your facts. Your job is to hand over the facts quickly.
</details>
### Step 9 — Choose containment, eradication and recovery actions (7 min)
It is now 09:00 on 4 November. The attacker's session ended at 02:41, but they still have Dave's password and possibly a new account. Here are ten possible actions. Sort them: which would you do **now** (contain), **next** (eradicate), **after** (recover and improve), or **not at all**? Pick the first three actions in order, and say why.
1. Disable `dave`'s account and force a password change.
2. Block `203.0.113.45` at the firewall.
3. Copy the logs, note the state of the server (who is logged in, open connections) and record who did it.
4. Find and delete the account created through `/admin/users/new`, and check `~/.ssh/authorized_keys` and scheduled jobs on `web01` for anything the attacker left.
5. Reboot `web01` to "clear things up".
6. Force password resets for all five staff accounts that were targeted.
7. Turn on a second factor (MFA) for SSH and for `/admin/`, and stop using the same password for both.
8. Add a limit on failed logins (for example, temporary lockout or rate limiting) for SSH and for `/admin/`.
9. Tell the privacy officer, management and (after legal advice) the authority and the affected customers.
10. Log in to `203.0.113.45` to see what is on it, or send it a message.
<details>
<summary>Show the answers</summary>
| Order | Action | Phase | Why |
|---|---|---|---|
| First (now) | **3.** Preserve evidence | Evidence | Costs five minutes and must happen before you change anything. Without it you can't prove what happened. (You already preserved the logs in step 2; record the live state too.) |
| Now | **1.** Disable `dave` and reset the password | Containment (short-term) | Closes the door the attacker used. |
| Now | **9.** Notify the right people | Communication | Notification clocks and decisions about customers start the moment you are aware. |
| Now (low value) | **2.** Block the address | Containment (short-term) | Cheap, but attackers change address easily. It is not a fix. |
| Next | **4.** Delete the new account and look for other persistence | Eradication | Disabling Dave isn't enough if the attacker has another way in. |
| Next | **6.** Reset all targeted accounts | Eradication | No evidence the others were guessed, but resets are cheap and the attacker has seen their names. |
| After | **7.** MFA and no password reuse | Recovery / improvement | Addresses the root cause: a password alone was enough. |
| After | **8.** Limit failed logins | Recovery / improvement | Would have turned 23 guesses into a lockout. |
| **Never** | **5.** Reboot | | Destroys volatile evidence and shows nothing useful. |
| **Never** | **10.** Contact or log in to the attacker's address | | "Hacking back" is illegal in most places, and the address may belong to an innocent person whose computer was hijacked. |
**Isolate or monitor?** The attacker is gone and data has already left, so there is no benefit in waiting: isolate (disable the account, remove the persistence). Watching would make sense if the attacker were still connected and you needed to learn how far they had got, but only briefly and with a plan to cut them off.
**In what order?** Preserve first (or at the same time as the others), then contain, then eradicate, then recover. Evidence first means the other actions can't destroy it.
</details>
### Step 10 — Write the incident report (6 min)
Create a report from this template, then fill in each part:
```bash
cat > report.md <<'EOF'
# Incident report: <short title>
- Incident ID: IR-2026-001
- Reported by: <your name>, <date and time>
- Status: <open | contained | closed>
## Summary
<Two or three sentences for a non-technical reader: what happened, what was affected.>
## Timeline (UTC)
- <time> - <event> (<source log>)
## Impact
- Functional impact: <category and reason>
- Information impact: <category and reason>
- Recoverability: <category and reason>
- Notifications: <who must be told, and by when>
## Root cause and contributing factors
- <the condition that made the incident possible>
## Response
- <what was done to preserve, contain, eradicate and recover>
## Lessons learned and actions
| Action | Owner | Due |
|---|---|---|
| <action> | <name> | <date> |
EOF
nano report.md
```
Fill in `report.md` using your timeline and classification. Keep the summary short and free of jargon, as if for the owner of the company.
<details>
<summary>Show an example of a completed report</summary>
```markdown
# Incident report: Compromised staff account used to download customer data
- Incident ID: IR-2026-001
- Reported by: Analyst, 4 November 2026 09:00 UTC
- Status: contained
## Summary
On 4 November between 02:11 and 02:41 UTC an attacker guessed the password of a staff
member (dave) by trying common passwords on many accounts. They logged in over SSH and
used the same password on the admin web pages, where they downloaded the customer and
order lists and may have created a new account. The website was not interrupted.
## Timeline (UTC)
- 02:11:05 - Password guessing against 8 names starts from 203.0.113.45 (auth.log)
- 02:14:28 - Login as dave accepted from 203.0.113.45 (auth.log)
- 02:17:30 - Probes for /.env, /wp-login.php, /phpmyadmin/ (web.log)
- 02:19:05 - /admin/ opened as dave (web.log)
- 02:20:33 - customers.csv downloaded, 4,812,034 bytes (web.log)
- 02:23:45 - POST /admin/users/new returned 302, possible new account (web.log)
- 02:31:50 - orders.csv downloaded, 1,930,466 bytes (web.log)
- 02:41:18 - SSH session of dave ended (auth.log)
## Impact
- Functional impact: None. The site and SSH kept working.
- Information impact: Privacy breach (customer list) and proprietary (orders).
- Recoverability: Not recoverable for the stolen data; regular for the systems.
- Notifications: Privacy officer informed at once; legal to decide on notifying the
supervisory authority (72 hours from awareness if GDPR applies) and customers.
## Root cause and contributing factors
- Root cause: SSH and /admin/ accepted a password alone from any Internet address,
with no lockout or second factor.
- Contributing: the same password for SSH and the web pages; no alert on 23 failed
logins in three minutes; the logs were read only the next morning.
## Response
- Logs copied read-only and hashed (SHA-256) before analysis.
- Account dave disabled and password reset; 203.0.113.45 blocked.
- Planned: remove the account created at 02:23, review authorized_keys and scheduled
jobs, reset all targeted accounts.
## Lessons learned and actions
| Action | Owner | Due |
|---|---|---|
| Require MFA for SSH and /admin/ | IT lead | 2026-11-18 |
| Lock out or rate-limit after repeated failures | IT lead | 2026-11-11 |
| Alert on more than 10 failed logins per address in 5 minutes | IT lead | 2026-11-18 |
| Use separate credentials for SSH and web admin | IT lead | 2026-11-25 |
| Review and delete the account created at 02:23 | App owner | 2026-11-04 |
```
</details>
## Verification
Check that your findings match. Run these and compare:
```bash
grep 'Failed password' auth.log | grep -c '203.0.113.45'
grep 'Accepted' auth.log | grep -c '203.0.113.45'
awk '$1=="203.0.113.45" && $10 > 1000000' web.log | wc -l
sha256sum -c evidence/SHA256SUMS
```
Expected output:
```text
23
1
2
evidence/auth.log: OK
evidence/web.log: OK
```
- [ ] 23 failed logins and 1 accepted login from `203.0.113.45`.
- [ ] 2 large downloads (`customers.csv` and `orders.csv`) by the same address.
- [ ] Evidence copies verify as `OK`.
- [ ] Your timeline has the SSH events and the web events in time order.
- [ ] You classified the incident as high priority although functional impact is none, and you can say why.
- [ ] Your report has a root cause that is a missing control, not "Dave chose a weak password".
## Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| `wc -l` shows different line counts | A paste was cut off or the `EOF` line was copied twice | Delete the file with `rm auth.log` (or `rm web.log`) and paste the whole block again, from `cat` to `EOF` |
| `bash: warning: here-document ... delimited by end-of-file` or the terminal waits with a `>` prompt | The closing `EOF` is missing or has spaces before it | Press `Ctrl+C`, then paste the block again including the last `EOF` on its own line |
| `grep` prints nothing | A typo in the address or file name, or you are in the wrong folder | Run `pwd` (it must end in `ir-lab`) and `ls`; check `203.0.113.45` |
| `sha256sum: command not found` (macOS) | macOS uses another command | Use `shasum -a 256` instead of `sha256sum`; for the check use `shasum -a 256 -c evidence/SHA256SUMS` |
| `sha256sum -c` says `FAILED`, or the hashes differ from the lab | The log text differs by a character, for example a space | Compare line counts, then paste again. Only the exact lab text gives the same hashes |
| `cp: cannot create regular file ... Permission denied` after running step 2 twice | The evidence files are read-only | Normal: that is what `chmod a-w` is for. Skip step 2 the second time |
| A number prints as `6.78619e+06` | Your `awk` prints large numbers in scientific form | Use the `printf "%d bytes\n"` form of the command from step 6 |
## Challenge (optional)
Without step-by-step instructions:
1. Write one `awk` command that prints only the **first** and **last** timestamp of the attacker's events in `web.log`.
2. Write a `grep` and `awk` pipeline that shows, for every address in `auth.log`, how many *different user names* it tried. Which address tried the most?
3. Design a simple alert rule in words (threshold and time window) that would have caught this attack. How many failed logins from one address in how many minutes? What false positives might it have (think of the people in the log who mistyped)?
4. In the report, the root cause is a missing control. Name two other contributing factors and the action that fixes each.
## Cleanup
Remove everything the lab created. The `evidence` copies are read-only, so first restore write permission:
```bash
cd ~
chmod -R u+w ~/ir-lab
rm -r ~/ir-lab
ls ~/ir-lab
```
Expected output:
```text
ls: cannot access '/home/<your-user>/ir-lab': No such file or directory
```
The folder `~/ir-lab` and its contents (the two logs, the evidence copies, `timeline.txt` and `report.md`) are gone. Nothing else was installed or changed. (On macOS the last message reads `ls: /Users/<your-user>/ir-lab: No such file or directory`.)
## What you learned
- Ranking source addresses with `grep | awk | sort | uniq -c | sort -rn` quickly shows who is guessing passwords.
- Password spraying tries a few passwords on many accounts; a successful login right after a burst of failures from one address means a probable compromise.
- Two logs tell more than one: the SSH log showed *how* the attacker got in, the web log showed *what* they did.
- A timeline, built from several sources, turns scattered lines into a story and reveals what you still don't know.
- Triage weighs functional impact, information impact and recoverability: here the impact was silent and the priority high.
- Preserve evidence first (copy, hash, record), then contain, eradicate and recover; never reboot or hack back.
- A good report names a root cause that is a missing control, and lists owned, dated actions.