#Rootme TryHackMe
First, let’s get information about the target.
Scan the machine, how many ports are open?
nmap -sV -sC 10.10.82.73
|
|
Les ports ouverts d’après nmap sont : 22;80
What version of Apache is running?
La version d’Apache est 2.4.29
What service is running on port 22?
SSH
Find directories on the web server using the GoBuster tool.
dirsearch -u [http://10.10.82.73](http://10.10.82.73/) -r
On retrouve /js, /panel, /uploads
What is the hidden directory?
/panel/
Getting a Shell
Find a form to upload and get a reverse shell, and find the flag.
On remarque qu’on peut upload des fichiers php en remplaçant php par phtml ou php3. On créer donc notre fichier form.phtml à upload :
|
|
Ce site propose de bonnes payloads :
https://www.yolospacehacker.com/fr/toolbox.php?cat=Webshell
On upload le fichier, on le retrouve à l’url upload/form.phtml et on a bien un revershell dans l’url par la suite. On cat sur le fichier user.txt et hop on a le flag
Okey, vrai bail pour avoir un super reverse shell :
On prend le fichier :
https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php
On y ajoute l’ip de notre machine, ici l’ip tun0 car c’est l’interface réseau qui correspond à celle connecté au réseau de tryhackme via VPN. Puis on lance nc -lvnp 1234
pour écouter sur notre machine. On upload le fichier et on aura un shell.
Privilege escalation
Now that we have a shell, let’s escalate our privileges to root.
Search for files with SUID permission, which file is weird?
find / -user root -perm /4000
on trouve qu’il y a un binaire étrange : /usr/bin/python
Find a form to escalate your privileges.
On va donc sur GTFObins et on lance la payload pour les SUID, et nous voila root.
root.txt
THM{*************************}