Born2root
Last updated
Last updated
Jumping straight into Port 80 we come to the landing page for a company named 'Secretsec'. Secretsec appear to provide defensive secutity operations to potential clients.
Immediately we have three names available to us:
Martin
Hadi
Jimmy
I added the users to a text file and ran Hydra against the names for SSH
. Unfortunately after sometime this did not provide any results and is unlikely to be the intended path.
Next I decided to run feroxbuster to enumerate directories and web pages.
Of course robots.txt looks interesting. Reading the contents of this file shows the following results:
Checking /files reveals no interesting information.
Of course /wordpress-blog/ is a troll.
Running feroxbuster on /wordpress-blog/ produced no further information and I was unable to extract any information otherwise.
Looking at the feroxbuster results I decided to have a quick look at /icons/ and right at the top we have a non default TXT file.
Opening the text file we are given a RSA key.
Since we know of three potential users on the target machine we can do a little bit of guess work with the key. First copy the key to the attacking machine and set the correct permissions.
We can then connect in as the user martin.
It appears you can enter anything to skip the password prompt.... I then tried to upload linpeas
with wget
and curl
and was unable to do so as per below:
We can upload via SSH
however.
After running linpeas we identify the file /tmp/sekurity.py is executed every five minutes in the context of the user jimmy.
When checking for the file we find it does not exists. As such we can create a python reverse shell file and call it sekurity.py.
First I used nano to create and start editing the python file. In which I passed a python reverse shell into.
After saving the file I set a netcat
listener on my attacking machine.
Soon landing a shell as the user jimmy.
Looking at the contents of jimmy's home directory we see a binary with the root SUID bit set.
Running the binary pings local host and shows ifconfig
information. I was unable to execute with any extra commands for exploitation. Running strings on the binary shows the 'echo' command without a fully defined path.
I did try creating my own malicious echo binary on jimmy's home directory and changing path to execute this directory first. This did not work for some reason.
Desperate enough at this point I grepped rockyou.txt for our last remaining user 'hadi' and sent the results to a text file.
I then used the text file with Hydra to bruteforce SSH which actually worked.
After connecting as hadi I got stuck again and out of sheer desperation tried switching to root with the password of 'hadi123' which worked...