OverPass 2 - Hacked

Date: 20, May, 2021

Author: Dhilip Sanjay S


Click Herearrow-up-right to go to the TryHackMe room.

Forensics - Analyse the PCAP

  • Open the pcap file in wireshark.

What was the URL of the page they used to upload a reverse shell?

  • Answer: /development/

  • Steps to Reproduce:

    • By analysing the initial 30 packets, we find that payload.php is being uploaded to /development/.

Overpass2 - Analysing PCAP

What payload did the attacker use to gain access?

  • Answer:

  • Steps to Reproduce:

    • View the data of packet number 14 (POST request made to /development/upload.php)

    • Inorder to copy the data, use xxd over the hexdump of data:

Overpass2 - Payload

Follow TCP Stream

  • Now we know the attackers IP address, so we can filter out the noise and get the necessary packets!

  • Apply the filter: ip.src == 192.168.170.145

  • Right Click on the packet from whcih you can find shell commands (like id, sudo -l) and select Follow -> TCP Stream.

Overpass2 - Follow -> TCP Stream
  • You'll get the pop up window containing all the shell commands run by the adversary.

    • Shell stabilizing

    • Fetching the ROT47 password of www-data: [{"name":"System","pass":"saydrawnlyingpicture"}]

    • Switching to james user with the password: REDACTED

    • Dumping the /etc/shadow file

    • Setting up ssh backdoor on port 2222 for persistence using https://github.com/NinjaJc01/ssh-backdoor.

What password did the attacker use to privesc?

  • Answer: REDACTED

How did the attacker establish persistence?

  • Answer: https://github.com/NinjaJc01/ssh-backdoor

Using the fasttrack wordlist, how many of the system passwords were crackable?

  • Answer: 4

  • Steps to Reproduce:

    • Crack the hashes using hashcat

    • Mode - 1800 sha512crypt $6$


Research - Analyse the code

What's the default hash for the backdoor?

  • Code:

What's the hardcoded salt for the backdoor?

  • Answer: 1c362db832f3f864c8c2fe05f2002a05

  • Code:

What was the hash that the attacker used? - go back to the PCAP for this!

  • In PCAP file, we have the hash:

Crack the hash using rockyou and a cracking tool of your choice. What's the password?

  • Answer: REDACTED

  • Steps to Reproduce:

    • Identify the hash type using haiti.

    • Crack the hash:salt using hashcat.

    • Mode - 1710 sha512($pass.$salt)


Attack - Get back in!

The attacker defaced the website. What message did they leave as a heading?

  • Answer: H4ck3d by CooctusClan

Overpass 2 - Defaced Webpage

Using the information you've found previously, hack your way back in!

  • The SSH backdoor was created on port 2222.

  • We can confirm that by running a nmap scan

  • Using james as the user and the hash we recently cracked as the password, we can login into the backdoor:

  • Note: -p argument must be used to specify the port!

What's the user flag?

  • Answer: thm{REDACTED}

  • Steps to Reproduce:

    • The backdoor! It only checks the password.

Overpass 2 - user.txt

Privilege Escalation

  • Intially tried to use the passwords of james for sudo access. But this was in vain.

  • The password must have been changed by the attacker!

  • Running Linpeas

  • Opps, I missed the hint in tryhackme. Going back to /home/james, I was able to find hidden executable .suid_bash

  • Privilege Escalation using .suid_bash:

What's the root flag?

  • Answer: thm{REDACTED}

  • Steps to Reproduce:

Overpass 2 - root.txt

Last updated