Let’s add that redir to hosts!
Just add 10.10.172.45 creative.thm to /etc/hosts
While we check webpage let’s run ffuf fuzzer:
Looking thru source code and page I found nothing interesting. Based on that we are using domain to acess it let’s search for subdomains:
Let’s edit hosts entry:
10.10.172.45 beta.creative.thm creative.thm
After fuzzing on that domain nothing was found.
On webpage we see such service:
Let’s try http://localhost
It returns html from that domain.
Instantly I remembered about local files let’s test that with file:///etc/passwd
Sadly it doesn’t work
At this point I tried everything think even php revshell but it didn’t work
So I checked other writeups and found that we need SSRF attack to scan internal ports that are not accessible from outside.
Port 1337 is super interesting cause it’s not random number.
Let’s check localhost:1337 with that service.
So we can just get any file with that
For example http://localhost:1337/etc/passwd
The only interesting user here is saad
So checking http://localhost:1337/home/saad
We already can read user.txt
Let’s also check http://localhost:1337/home/saad/start_server.py
Nothing interesting here.
The only things left are .local and .ssh
In .local there is nothing interesting
So let’s just get http://localhost:1337/home/saad/.ssh/id_rsa
Let’s save it and use to login as saad
Of course don’t forget to set permissions to read only by owner with chmod 400 id_rsa
So we will need to crack it. I’ll use john.
I had to run attackbox cause john on my machine for some reason didn’t want to crack it.
After signing in thru ssh with ssh [email protected] -i id_rsa we can start searching for interesting stuff.
So now we have password. Let’s try using sudo as it’s easiest privesc technique.
We can only run ping which doesn’t really give any option to privesc alone.
Also we are passing LD_PRELOAD env var to sudo so we can use it to do something. I don’t really know what is it and how it works but I remember that gamemode and mangohud which are wrappers for gaming had it. So I assume that we can run some code with it cause wrappers can kinda inject into processes.