Breaking the Team: A Deep Dive into Multi-Stage Linux Exploitatio
A Local File Inclusion vulnerability on a development subdomain allowed reading a backup SSH private key left in a configuration file, giving initial access. Further privilege escalation via a command injection in a script and abuse of LXD group membership led to full root access on the host.
Published on medium.com
In this walkthrough, we will explore the compromise of the “Team” machine from TryHackMe. This lab is a masterclass in the Unified Kill Chain (UKC), demonstrating how a simple web vulnerability can lead to a full host takeover through credential leaks, lateral movement, and container abuse.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely multiple mistakes: an LFI vulnerability in a PHP script, a private SSH key stored in a configuration file, a bash script that executed user input as a command, and a user being in the lxd group which grants effective root access.
Impact
An attacker could gain initial access as a regular user, escalate to another user, and finally achieve root-level access on the host, fully compromising the system.
What the attacker needed
Access to the web application; ability to reach the development subdomain; SSH access to the host; user dale has sudo rights to run a script as gyles
The fix
The report does not state that the issues were fixed; it recommends not storing secrets in configuration files, avoiding execution of user input in scripts, auditing powerful group memberships like lxd, and using whitelists for file inclusion.
How it was found
- Discover the development subdomain dev.team.thm via subdomain fuzzing.
- Find the PHP script with a page parameter and confirm LFI.
- Use LFI to read /etc/ssh/sshd_config and extract the embedded SSH private key.
- Save the key, set permissions, and SSH into the host as user dale.
- Run sudo -l as dale to find a script executable as user gyles, then exploit command injection to spawn a shell as gyles.
- As gyles (member of lxd group), create a privileged LXD container mounting the host root filesystem, then access the host as root.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A Local File Inclusion (LFI) flaw lets an attacker make a web page show files from the server that should not be visible. Here, that exposed a private SSH key stored in a configuration file, which the attacker used to log in as a user. Later, a script that ran user input as a command and membership in a powerful group allowed the attacker to become root.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.