LookUp (THM)
Test your enumeration skills on this boot-to-root machine.
Intro.
Hi My Hackers fellos today we have a fresh THM mchaine look intresting let's ge right into it
Enumeration.
Port scanning.
Classic HTTP , SSH let's see the web page.
Enumerate HTTP.
So after some fuzzing i notice something intresting.
If the username and the password are wrong we get this error message.
so i test the admin user and it indded exist.
Notice the Error message says the password is wrong not both as the first try.
And after some fuzzing i foudn a common password.
and when i try to login i got this.
and then i decide to use this password to enumerate other users.
and after i test this creds i got this.
another subdomain i do not know i enumerate subdomains but i did not find it from some reason anyway let's continue.
once we login we gonna be here which looks that its shows a files.
Getting Shell.
So after some enumeration i found that this system is as shown below.
elfinder is an open source file manager on the web.
https://github.com/Studio-42/elFinder
and as we can see the version by simple looking we can find that its vulnerable to command injection.
And also we can find a metasploit, exploit for this vulnerablity.
Getting Shell as think.
So after i got shell on the www-data user i start searching for a way to trying to get shell as think as he the only user in the system.
After a bit i searched for the suid binaries.
and the most important on was 'pwm' which i have not seen before after a bit of search i found this.
so i test the application and i saw this.
i wanted to reverse engineer the file so that i know how does he access the 'id' command if he uses relative path this would make it easier to manipulate with the PATH env variable.
I think you could tell now where am i going with this. Before i reverse engineer i decided i want to test to put malicious id file to echo the think info instead of www-data, and modify the PATH env variable.
and the final id file will look like this.
and as you can see we did it. now he thinks that we are think and did reveal all the passwords in the .password file of the user think. now i will try to brute force ssh login using these passwords.
and as you can see now we indded find the password.
Root.
Reading the root.txt file.
so after i login i checked the sudo -l command and i found this.
a very simple search we can find a way to read the /root/root.txt file.
Getting shell on the Root user.
using the same look command we can find the ssh key of the root user.
and we just copy it into our machine change its permission into 600 and login via ssh key.
Conclusion.
Last updated