Mailroom is a linux machine in HackTheBox's Open Beta Season.
Enumeration
Zenmap:
View website, it show Made with ♥ for mailroom.htb, add mailroom.htb in hosts file.Brute-force subdomain with gobuster:
Add git.mailroom.htb in hosts file. View git.mailroom.htb, this is a Gitea website. Browsing the site it shows sourcecode staffroom.Read file auth.phpI see another subdomain exists staff-review-panel.mailroom.htb add to the file host, try to open the website but the website gives an error, I guess it's a private website.
See mailroom.htb at Contact
Then the site shows me a popup:ExploitCreate 1 payload file pwned.js, code redirects to subdomain staff-review-panel.mailroom.htb, As a result, I get the base64 content of the index.php file.
Instead of sending from Contact, I use burpsuite to send the payload.
I get the username, I do the same with the password.In file auth.php:
$user = $collection->findOne(['email' => $_POST['email'], 'password' => $_POST['password']]);
Service connects to mongodb, from this code, I guess I can use nosql injection exploit.
The results show that the nosql inject exploit is successful.With regex nosql injection. I write a payload that does the brute-force email.
I see that the process is scanning to an then stop, the reason may be overtime running process.I changed cal(chars, ""); to cal(chars, "an"); and try again.
Continue with the steps above until no further response is received.Source code pwned: https://github.com/dryu8/hackthebox/tree/main/Mailroom
You can try to use 2 file passpwned.js and userpwned.js in source my code pwned instead pwnedpass.js and pwneduser.js.
Now, i got the email: ****tan@mailroom.thb and password: 69t*********. Use them for ssh login.I had Tristan Shell.
My English is not good so if you want to share anything please comment below, I have set comment for all user.
Hi bro. First Thanks your sharing, It help me a lot.
but I am not sure its a good choice to use English to write.
Maybe the h tb policy will detect more easily. I had seen some blog remove their page.
Maybe you can preserve the english page until the deadline
best regard
Thanks your sharing. I will temporarily close this post, until I'm sure I'll reopen it.