Sitemap
Solocoderider

Solocoderider

Ethical Hacker Happy to serve you 😊

4 min readFeb 14, 2022

--

TryHackMe : OVERPASS Walkthrough

Task 1

Deploy the machine after connecting to openvpn.

Press enter or click to view image in full size
sudo openvpn <OPENVPN_NAME>

Lets Dig in.

Scan for the open ports.

Press enter or click to view image in full size
sudo nmap -A -Pn <MACHINE_IP>

then we got http and ssh as open port. now I am going look http site with this ip.

Press enter or click to view image in full size

In this I can’t find anything helpful so I decided to look for hidden directories with help of gobuster.

Press enter or click to view image in full size
gobuster dir -u http://<machine_ip> -w <wordlist>

That’s interesting I got an admin panel (/admin).

so lets see what in there

Press enter or click to view image in full size

it is a login page so I tried default credential and SQLi to get logged in

Press enter or click to view image in full size

that not works anymore here.😪

Finally I decided to check the response of this request using burp suit repeater.

Press enter or click to view image in full size

here we go… the request seems 200 ok but it fails to login which means there is no proper validation.

So I changed the response from first captured request in proxy and forward it by Do intercept option in burp suit as you see below.

Press enter or click to view image in full size
Press enter or click to view image in full size

and refreshed the page after forwarding the response (turn of the proxy before refreshing).

Press enter or click to view image in full size

We got a RSA key of user james. lets connect it through ssh .

RSA connection procedures

Press enter or click to view image in full size
nano key.txt
  1. Save the RSA as a text file.
  2. change the permission into 600. chmod 600 filename

Now try to connect it..

Press enter or click to view image in full size
ssh -i <key.txt> <username@IP>

there is a problem we need a passphrase for this RSA key.

Get Solocoderider’s stories in your inbox

Join Medium for free to get updates from this writer.

For that we use ssh2john.py it will change this into an hash and we can crack it with john the ripper.

Press enter or click to view image in full size
python /usr/share/john/ssh2john.py key.txt > key.hash

Now crack this with john.

Press enter or click to view image in full size

try to login with this key and passphrase.

Press enter or click to view image in full size

We get in successfully. lets read the user.txt

Press enter or click to view image in full size

Its Time To Escalate

For this we looking for cron-job.

Press enter or click to view image in full size
cat /etc/crontab

We are lucky because here root running a cron-job to curl into a hosted service if we can duplicate the hosts in our machine we can execute a reverse shell of root.

Press enter or click to view image in full size
In Our Machine

We making a directors and file exactly like in cron-job.

Press enter or click to view image in full size
change ip with your tunneling IP

and write a script for reverse shell, Then host a python server in parent folder

Press enter or click to view image in full size

Now its time to change IP in overpass machine to our server’s IP which is our tunneling IP.

Press enter or click to view image in full size
nano /etc/hosts

open a new tab and start netcat listner on port 1234

Press enter or click to view image in full size
nc -lvnp 1234

Yess we got the root shell.🥳

Press enter or click to view image in full size

check for the flag.

Press enter or click to view image in full size

Enter user flag and root flag in tryhackme and complete the challange.

Press enter or click to view image in full size

Thank you for reading this writeup. Hope you understand how we get complete. follow me Instagram for updates of latest security reports.

--

--

Solocoderider
Solocoderider

Written by Solocoderider

Ethical Hacker Happy to serve you 😊