1. Overview and authorized-lab scope
This is an evidence-led account of my work in the TryHackMe Airplane room. It documents an authorized training machine only. The room allocates a new machine address when it is started, so every reusable command below uses TARGET_IP rather than the address visible in my historical captures. Those addresses remain visible in the screenshots because they are part of the original evidence, not instructions for a reader to reuse.
The investigation combined web-path testing, Linux process discovery, an exposed debugging service, local privilege boundaries, SSH troubleshooting, and a sudo configuration weakness. The useful lesson was not to jump from a scan to a supposed exploit. At each stage I needed to establish what the evidence actually proved, identify what was still unknown, and use that uncertainty to choose the next check.
Before starting, launch the room, allow it to boot, and set the address assigned to your instance. The official TryHackMe Airplane room confirms that the machine exposes a deployable lab target.
export TARGET_IP='<YOUR_ROOM_IP>'
printf 'Current Airplane target: %s\n' "$TARGET_IP"
Do not copy a target address from any screenshot in this article. Likewise, no user or root flag value, private key, password, or authenticator value is included here.
2. Attack-path map and evidence standard
The final chain was:
Nmap → Werkzeug service on 8000 → page traversal → /proc process discovery
→ gdbserver on 6048 → hudson shell → SUID find → effective carlos identity
→ stable carlos SSH context → sudo Ruby path weakness → root
The original 245-page history includes commands I entered, assistant suggestions, repeated variations, and unsuccessful attempts. Those are not interchangeable. This write-up uses three labels in the narrative:
- Verified evidence means a screenshot or captured output directly shows the result.
- Transcript-supported methodology means the supplied session records the technique and its relevant observation, but there is no clean standalone screenshot for that precise response.
- Troubleshooting means an attempt failed or produced a limitation. It is retained where it explains why the next decision changed.
That distinction matters most around remote GDB execution and the SUID-to-SSH transition. A debugger run is not itself proof of a callback; euid=carlos is not itself a normal login; and a command suggestion in a conversation is not proof it succeeded.
3. Initial enumeration: reduce the unknowns
The first original capture shows three exposed TCP services. SSH on 22 was a future access path, but it did not provide credentials or a key at this point. Port 8000 was an HTTP service fingerprinted as Werkzeug/Python. Port 6048 was labelled x11? by Nmap, which is useful only as an initial hypothesis: service guesses must be checked against other evidence before they drive an exploit path.
The exact Nmap flags are not preserved in the screenshot, so I do not claim a command line that the evidence does not show. A sensible room-local starting point is to scan the address currently assigned to the reader:
nmap -sC -sV -oA airplane "$TARGET_IP"
The historical scan output established these findings:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu
6048/tcp open x11? service fingerprint uncertain
8000/tcp open http Werkzeug httpd 3.0.2 (Python 3.8.10)
Figure 1. Original enumeration evidence from my Airplane instance. The address is historical lab evidence. The important result was the combination of SSH, an unexplained 6048 listener, and Werkzeug on 8000.
The HTTP response also pointed to the Airplane virtual host on port 8000. That made the web application the most productive next surface, while port 6048 remained a question to resolve rather than a service to guess at.
4. Web application behavior and the virtual-host redirect
The Nmap capture records a redirect to airplane.thm:8000/?page=index.html. In a current room instance, map the hostname to the address assigned to you before following that virtual host:
printf '%s airplane.thm\n' "$TARGET_IP" | sudo tee -a /etc/hosts
curl -i "http://airplane.thm:8000/?page=index.html"
The page parameter was the significant feature. The original transcript records inspection of the application behavior and a path construction equivalent to a static/ prefix combined with user input. This is risky because a file-serving function must verify the resolved path, not merely concatenate a prefix and assume the result remains inside that directory.
The transcript-supported checks began with a known system file and then moved to procfs:
curl -s "http://airplane.thm:8000/?page=./../../../../etc/passwd" | head
curl -s "http://airplane.thm:8000/?page=./../../../../proc/self/environ"
The recorded response from the environment lookup exposed the hudson context. That did not grant a shell; it established that the application process and filesystem had useful information to inspect. The source package does not contain a readable browser screenshot for the first successful traversal response. I am therefore not inventing a web PoC image or presenting an unverified response as a capture.
The next reasoning step was straightforward: if a file parameter could reach procfs, it could answer the service-identification question left by port 6048.
5. LFI-led process enumeration: explaining port 6048
Linux procfs exposes process information through paths such as /proc/<PID>/cmdline. A PID is ephemeral, so it is not appropriate to copy a historical PID into a reusable procedure. The relevant approach is to iterate over the current machine’s candidate PIDs and keep only non-empty responses that do not contain the application’s error text:
for i in $(seq 1 1000); do
out=$(curl -s "http://airplane.thm:8000/?page=./../../../../proc/$i/cmdline")
if [ -n "$out" ] && [[ "$out" != *"Page not found"* ]]; then
printf '/proc/%s/cmdline: %s\n' "$i" "$out"
fi
done
The source history also records a small Python variant for the same purpose. The method is useful when a terminal loop produces too much output: request each cmdline entry, discard the application’s known error response, and stop when the service name appears.
import requests
for pid in range(1, 1001):
url = f"http://airplane.thm:8000/?page=./../../../../proc/{pid}/cmdline"
response = requests.get(url)
if response.status_code == 200 and response.text and "Page not found" not in response.text:
print(f"/proc/{pid}/cmdline: {response.text}")
The recovered transcript records the decisive observation:
/usr/bin/gdbserver 0.0.0.0:6048 airplane
This output reclassified port 6048. Nmap's x11? value was an uncertain fingerprint; the process command line identified a GDB server bound to every interface. /proc/net/tcp was also requested in the original history, where the hexadecimal port 17A0 corresponds to decimal 6048. Together, the process command line and listener port were stronger evidence than the scan label alone.
There is no clean screenshot of the successful procfs response among the surviving assets. The absence is explicit rather than hidden: this stage is transcript-supported, while the next stage has a genuine GDB capture.
6. GDB server execution attempts and troubleshooting
The exposed debugger changed the problem from service identification to controlled execution in the lab process context. The recorded GDB workflow connected to the current room target, transferred an ELF into the hudson-accessible path, set that path as the remote executable, and ran it:
(gdb) target extended-remote <YOUR_ROOM_IP>:6048
(gdb) remote put binary.elf /home/hudson/binary.elf
(gdb) set remote exec-file /home/hudson/binary.elf
(gdb) run
Figure 2. Original debugger evidence. It shows the remote connection and file transfer. The program exits normally in this capture, so it is not treated as proof of a received shell.
This was the most troubleshooting-heavy part of the original session. The history includes target-versus-attacker address confusion, placeholder syntax being adjusted, commands issued in the wrong context, and attempts where GDB reported that an inferior exited normally. Those details explain an important operational point: the debugger target is TARGET_IP:6048, whereas any listener address must be the address of the attacker machine's VPN interface. They are different roles.
For a current lab, record the attack-machine address separately rather than copying the historic one:
ip -brief address show tun0
# Note your own VPN address as LHOST for your authorized lab workflow.
The source shows multiple payload construction and execution variations. I do not reproduce a full callback payload here because the evidence does not independently preserve one final, canonical build command as the sole successful route. What is verified is the next event: the listener received a connection and the shell identity was hudson.
7. Initial foothold: verifying hudson
A later terminal capture provides the first unambiguous shell evidence. It shows the listener receive a connection and id return the hudson account:
Connection received on <HISTORICAL_LAB_IP> <EPHEMERAL_PORT>
uid=1001(hudson) gid=1001(hudson) groups=1001(hudson)
Figure 3. The genuine callback capture verifies the hudson foothold. The visible target address belongs to my resettable room instance and is not copied into procedures.
This is why the article separates the GDB screenshot from the listener screenshot. The first proves the debugger interaction; the second proves the first shell. With hudson confirmed, the investigation moved from remote access to local privilege boundaries.
8. Local enumeration and the SUID find result
The recorded local enumeration searched for files with the SUID bit. This is a standard observation step in an authorized Linux lab because a SUID binary can execute with the effective identity of its owner. The original session recorded /usr/bin/find as relevant.
find / -perm -4000 -type f 2>/dev/null
The next command used find to execute a shell while preserving effective privileges:
find . -exec /bin/sh -p \; -quit
id
The resulting identity is one of the clearest pieces of evidence in the whole history:
uid=1001(hudson) gid=1001(hudson) euid=1000(carlos) groups=1001(hudson)
Figure 4. The SUID transition is verified by the id output: hudson remains the real user while carlos becomes the effective user.
The distinction is not cosmetic. An effective UID can change what a process may access, but it is not automatically a fully authenticated carlos login. The session continued to encounter ownership, terminal, and sudo-context constraints. Treating euid=carlos as if it were root—or even a clean SSH account—would have made the narrative technically wrong.
9. Why the early Ruby attempts failed
The historical screenshots include failed attempts around the Ruby path and attempts to read a root-only file. They belong in the walkthrough because they show the boundary was still real. The terminal records Ruby permission errors and a failed root-file access rather than a successful root shell.
Figure 5. Genuine troubleshooting evidence. It documents intermediate errors and must not be presented as final root proof.
The reasoning correction was to stop treating the SUID shell as a complete carlos session. The source history shows attempts involving PTYs, home-directory writes, key permissions, and file ownership. Those experiments were not all successful, but they pointed to the requirement for a stable carlos login before relying on the final sudo rule.
10. Establishing a stable carlos SSH context
The original conversation records SSH-key generation, authorized_keys placement attempts, directory mode checks, and corrections for permission problems. The private-key contents in the source are intentionally omitted. The reusable lesson is the permission model: SSH expects a protected .ssh directory and protected authorized_keys; an effective UID does not necessarily allow every ownership change required by the server.
The transcript-supported setup pattern was:
mkdir -p /home/carlos/.ssh
chmod 700 /home/carlos/.ssh
chmod 600 /home/carlos/.ssh/authorized_keys
ssh -i <YOUR_PRIVATE_KEY_FILE> carlos@airplane.thm
I do not claim the preceding lines were a one-shot success. The source history contains failures before the stable session. What is verified by the surviving evidence is the eventual interactive prompt:
carlos@airplane:~$
Figure 6. Genuine evidence of the stable carlos SSH context. No private key is visible in this capture.
This was the correct time to inspect sudo policy, because the session now had the account context that the policy was intended to govern.
11. Sudo policy review and the Ruby wildcard weakness
From the carlos context, the source records sudo -l returning a narrow-looking but unsafe rule:
sudo -l
User carlos may run the following commands on airplane:
(ALL) NOPASSWD: /usr/bin/ruby /root/*.rb
The problem is not simply that Ruby appears in sudoers. Ruby is a general-purpose interpreter capable of loading and executing a file. Combining it with a wildcard path creates a path-validation question: will sudo's allowed command matching and the filesystem's final path resolution agree?
The source records a traversal-style path that begins with /root/ but resolves through .. to a temporary script:
sudo /usr/bin/ruby /root/../tmp/shell.rb
This is why the rule is dangerous. A configuration reviewer may see /root/*.rb and assume every permitted script stays in /root. A canonical-path check must consider the resolved path, while the safer design is to avoid wildcards and interpreter execution altogether. Allow a fixed, root-owned, immutable program with a narrowly defined purpose instead.
12. Final root verification and redaction
The final terminal evidence shows the Ruby invocation and an id result reporting root. The public-safe version below preserves the technical verification while covering the room flag with opaque redaction blocks.
uid=0(root) gid=0(root) groups=0(root)
Figure 7. Final root verification from the original session. Flag text is deliberately removed; the root identity remains visible.
No flag value is rendered in the text, caption, or image derivative. The unredacted source and any private-key material remain private research material rather than portfolio content.
13. Root-cause analysis and defensive takeaways
The room illustrates a chain of independent security failures. None should be evaluated in isolation:
| Observed weakness | Why it mattered in the lab | Defensive control |
|---|---|---|
| User-controlled file path | The page value led the investigation outside the intended static content and into procfs | Use allowlisted logical names; canonicalize a resolved path and reject any path outside the content root |
| Network-reachable gdbserver | The debugger accepted a remote connection on port 6048 and enabled execution in the lab process context | Disable debug services outside isolated development; bind management services to a protected interface and require authentication |
SUID find | A general-purpose binary could start a shell with carlos as its effective user | Remove unnecessary SUID bits; audit privileged binaries and replace broad utilities with purpose-built helpers |
| Wildcard sudo rule for Ruby | A general interpreter plus an unchecked traversal path weakened the intended /root/*.rb boundary | Avoid wildcards and interpreters in sudoers; permit a fixed root-owned script with a minimal, reviewable interface |
14. Closing notes
Airplane was not a perfect first-try chain. The original history contains wrong turns, normal program exits, permission failures, address-role confusion, and terminal limitations. Retaining those details makes the final route more useful: enumeration supplied questions, the web path behavior supplied a way to inspect processes, procfs explained port 6048, GDB led to hudson, SUID find changed the effective identity, SSH established a stable carlos session, and the Ruby sudo rule supplied the final root boundary failure.
Use this material only in the authorized TryHackMe room. Start your own instance, substitute its current TARGET_IP, keep flags and credentials private, and do not apply these techniques to a system without explicit authorization.