First thing we do is scan the ports:
Got 4 ports open!
Opened up port 80 on web but nothing shows up just a default working page for apache2
Since I made this challenge I wont dirbust coz I know once I dirbust nothing will show up , because there is nothing at all, which means the legit way is what i'll be showing (THE INTENDED WAY) of how to solve my box!
So first thing is to perform a subdomain scan
and we get 3 subdomains that are found :
So first thing comes into mind is that we already see that admin.sharp.h4k must be the admin panel and then the api.* is the api or somn' and then we have pma.sharp.h4k probably the phpMyAdmin portal.
Add those subdomains to your /etc/hosts
file then let's get started! by first checking the admin panel
And we are viewing a login page for an admin dashboard
Tryin SQLi wont work:) so it'll be a total waste of time but basically that is how a person solving this box would do , is try SQLi and maybe dirbusting but I assure you will get nothing at all:)
So let's check api.sharp.h4k
, we get an underdevelopment page , so this means the api is still underdev , but normally developers would have to save their backup file inside even though it's still underdevelopment so , let's try dirbusting this subdomain instead:
Okay looks like we have one directory , and that is /images/
So let's dive into it:
Alright looks like we have something that's named SECRET API CALLS
as the title!
this sure looks like a backdoor that a hacker might have installed in the same target that we are given , let's try typing in a command and see what we get!
That is what I got after typing id
, so yes we are right , it's a backdoor
We can easily get shell by just setting a listener and then forwarding our self a shell easy as that , so why not let's try it!
So on my terminal I'll set up a listener on port 1337
And then from the input i'll type in a command that will give us back a revshell as follows :
and then click submit
You didn't expect that to work did you??
Well the reason it didn't work it's because it's a server using a public IP and we are a private IP so it's either you use a VPS to grab shell or make ur localhost PUBLIC, well I have VPS so i'll just go ahead and use it instead! but if you are not having a VPS then you can use Ngrok for tunneling.
Alright Now that I have a listener running on my VPS , i just do the same methods but with my VPS's IP address and not my localhost
And boom we have SHELL!!!
So Now let's gather some config files and escalate our privileges to a user first of all let's check what user is available
we have a total of 2 users , who are xploiter
and babukrismasi
, so let's grab some config by performing some lateral movement
moving into admin
first because dashboards such of these usually have configuration files
I found Core.php
which has some connection to the MYSQL
So we got mysql
username and password which is root:superPassw0rd
, let's try reuse the same password for the users available.
I was now able to login via ssh to babukrismasi
with the password superPassw0rd
And we get the flag from his home folder:
Alright with that being found , let's escalate our privileges to root
So first we do is check what privileges we have that allows us to run a certain binary with SUDO perms using sudo -l
and we can run the binary named vitayakrismasi
using sudo
with user babukrismasi
so let's try and see what the binary does and try reverse it if it needs us to!
it needs a username to proceed, So I check the strings and I'm able to get a glimps of what the username and password might be:
so the usernames according to my gathering can be either spiderman
or fazakrismasi
, so let's give it a try
we get prompted for a password
but we dont know the password , I try performing Ltrace but still nothing comes accross
So there are baiscally two ways getting the password now , so the first way is to guess and the second way is to pull the binary to ur localhost for investigations , and i'll consider doing that way lol!
First move to /tmp
:
we get the binary also available over there, and we also have another file named tobedeleted.txt
let's read it inside:
Alright we get some numbers that make up the christmass date , that's probably the password let's test it on the binary:
And perfectly worked!
So now let's do it with sudo :
and we have the ROOT FLAG!!!
h4k-it{uschezenakrismasi_sio_poa}