TryHackMe|Brute It WriteUp\Walkthrough (English)
Brute It
Room Link: https://tryhackme.com/r/room/bruteit
=============================================================
- sudo nmap IP -Pn. You have 22,80 ports open. Run Nmap with -sV to see the versions for both.
- To know the version of the Linux distribution you can look at the results from the Nmap’s scan on the target for both SSH and Apache services Ubuntu.
- The page on the browser is just the default page for Apache. To get the hidden folder gobuster dir -w /usr/share/dirb/wordlists/common.txt -u http://IP -r, the hidden folder is /admin. Which is a login form.
- As it is an admin panel, it is most likely that the username is admin. To get the password intercept the login page using burpsuite to easily fill the blanks in your brute force using Hydra, also try login with invalid credentials to get the error message to be able to put it in your attack. sudo hydra -l admin -P /usr/share/wordlists/rockyou.txt IP http-post-form "/admin/:user=admin&pass=^PASS^:Username or password invalid".
- Now go to the /admin page and log in. It will give you the RSA key. Copy it and then save it to a file key. After that, change the permissions to 400. If you try to log in using this key it will request you a passphrase for the key. Therefore, we want the RSA key passphrase. We will retrieve it with the help of John. ssh2john key > sshkey.hash then john sshkey.hash --wordlist=/usr/share/wordlists/rockyou.txt. Now use the password to login to john’s account using ssh.
- List the current folder's contents you will get the user flag ✨.
- sudo -l you have permission to run cat command as root without a password. search for (root) NOPASSWD: /bin/cat you will get this result from GTFOBins https://gtfobins.github.io/gtfobins/cat/. Look at the sudo section and do as it tells you. This will print the /etc/shadow file for you.
Copy its contents to your device into a file called hashes then use to john to crack it john hashes.
- su root, then provide the password. cd /root and retrieve the root flag ✨.


Comments
Post a Comment