CTFroom: Overpass — Broken Authentication & Cron Job Script Hijacking
Analyzing client-side JavaScript authentication logic to bypass administrative login via cookie tampering, recovering an encrypted SSH private key, and exploiting a world-writable script invoked by root in crontab.
Challenge Overview
Overpass is a prime example of two prevalent real-world security vulnerabilities: client-side authentication decisions (OWASP Top 10 Broken Authentication) and insecure scheduled task configurations (Crontab script hijacking).
Phase 1: Port Scanning & Web Enumeration
Discovered services:
Navigating to http://10.10.74.32/, the site advertises "Overpass — The Secure Password Manager".
Directory brute forcing:
Discovered: /admin/ — presenting an administrative login portal.
Phase 2: Client-Side Broken Authentication
We inspect the client-side JavaScript handling the login at /admin/login.js:
The Critical Flaw:
The client-side code assumes that if a SessionToken cookie exists, the user is authenticated, without the backend verifying the token signature on protected pages!
We open Browser Developer Tools (F12) -> Storage / Console -> Cookies:
We refresh the page at /admin. Authentication is completely bypassed!
The administrative panel displays an encrypted RSA private SSH key for developer user james:
Phase 3: Cracking the SSH Private Key
We save the encrypted key to james_id_rsa and extract its hash with ssh2john:
Cracked passphrase:
We authenticate via SSH:
User flag recovered from /home/james/user.txt.
Phase 4: Cron Job Script Hijacking to Root
We inspect scheduled system tasks in /etc/crontab:
Notice this entry:
Root regularly curls http://overpass.thm/downloads/src/buildscript.sh and pipes it directly into bash!
Next, we check /etc/hosts permissions:
The /etc/hosts file is world-writable (666)! Any user can modify host resolution!
The Attack Vector:
/etc/hosts to redirect overpass.thm to our attacker machine IP (10.8.x.x).buildscript.sh on port 80.On our attacker machine:
In a separate terminal, start our Netcat listener:
Within 60 seconds, root executes the crontab job:
We are root. Root flag recovered at /root/root.txt.
Defense Remediation
chmod 644).