Overpass
Task 1: Overpass

Hack the machine and get the flag in user.txt
Let's run a
nmapscan against the machine.
There are two open ports:
22
ssh
80
http
Let's visit the machine using our browser.

There is nothing of use here.
Let's use
gobusterto perform directory brute forcing.
Let's go to the
/adminpage.

We can view the source code using
CTRL+U.

Let's view the
/login.jsfile.

In this code, the
login()function is what is important.
It takes the username and password from the user and then creates an object
credwith 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 > Storagetab.

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
johnto crack the hash.
Let's give the
rsa_keyfile elevated permissions.
We can now login as
jamesusing thersa_key.
We have to first check the contents in the directory.
Let's cat the
user.txtfile.
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.thmto our IP address so that when thecurl overpass.thm/downloads/src/buildscript.sh | bashcommand 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.shfile.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.txtfile.
Answer
Last updated
Was this helpful?