[Linux] Overpass
Reconnaissance
sudo nmap 10.10.108.252
sudo nmap -A 10.10.108.252

Enumeration
HTTP

Web page enumeration

We discovered a page named /admin, which might be worth exploring.

On this page, there's a login form. I attempted various techniques to bypass authentication: brute-force attacks, SQL injection, and exploiting known vulnerabilities. However, none of them worked.
After reviewing the hints provided, which mentioned the OWASP Top 10, I decided to explore the first item on the list: Broken Access Control. Inspecting the page source code in the browser's developer tools, I noticed something interesting in login.js, the application checks for a cookie named SessionToken.

By setting a fake value for this cookie, I was able to bypass authentication and access a page containing an RSA private key.

It appears the key belongs to a user named james. I saved it locally and set the appropriate permissions:

The private key is password-protected, so we need to crack it using John the Ripper:

With the recovered password, we can now SSH into the machine and retrieve the user flag.

Further exploring the "Overpass" application on the system, we obtain James's password, but this doesn’t yield any additional privilege or access.

Escalation
Process analysis
We use scp to upload pspy to the target machine. Monitoring processes reveals a cron job that downloads and executes a script from overpass.thm as root (uid=0).

We also confirm that we can edit the /etc/hosts file, which is useful given what we've just discovered:

Exploitation Strategy
On the attacker's machine, create a file named
buildscript.shcontaining a reverse shell payload.

Start a simple HTTP server in the directory containing two folders:
downloadsanddownloads/src. Placebuildscript.shinsidedownloads/src.

Start a listener to catch the reverse shell:
On the target machine, edit the
/etc/hostsfile to resolveoverpass.thmto the attacker's IP address.

Wait for the cron job to run. It will download and execute your malicious script as root, giving you a reverse shell with root privileges.

Conlusion
Weak credentials used for SSH private key.
Poor file permissions, allowing modification of critical files like
/etc/hosts.Insecure cron job that blindly downloads and executes scripts as root.
Last updated