I started this box with checking SMB. First I ran the following command with
smbclient to list shares.
Taking note of the non default share ‘sambashare’ I connected with
smbclient again, this time specifying that share that has been identified. After connecting I tried to upload with the
put command and was given ‘access denied. I grabbed the two files on the share and then disconnected.
Checking the contents of mailsent.txt reveals a user ‘daisa’. We also have the sender who is called ‘agi’ who may be a potential user. The comment regarding the secret is interesting and something we may be able to use later.
I checked the contents of wordpress.bkg.zip and was unable to identify any interesting information. Unfortunately the archive file did not contain a wp-config.php file which normally contains database information.
Checking port 80 we come to a website called ‘photographer’. I ran directory enumeration on this page and enumerated manually and was unable to discover anything of interest.
Moving over to port 8000 we land on what is assumed to be the web page which was mention in Agi’s email to Daisa. Noting from the footer the website is built with Koken.
I checked manually for common directories and was presented with a login page under the directory /admin.
Knowing Daisa likely has account on this as per the email we grabbed from SMB I entered the email address as ‘firstname.lastname@example.org’. For the password I tried ‘babygirl’ which was hinted from the email as well. Fortunately this gave us access.
Using the settings tab we take note we are run on version 0.22.24.
A simple search with searchsploit reveals ‘Arbitrary File Upload (Authenticated)’ for this particular version.
The exploit for this has been linked below.
As per the exploit instructions I went to ‘Import Content’ in the bottom right of the page.
I then selected a PHP shell which I had renamed to phpshell.php.jpg in order to bypass the upload filter. After selecting and uploading I caught the upload request with
On the highlighted line above I removed ‘.jpg’ from the end of the file name. After forwarding the request go back to Koken and look under the ‘Date Published’ section and find the uploaded file. Highlight the file and select ‘Download File’ on the right.
This will execute the PHP reverse shell and we get a shell on our
I then used the following command to make the shell more usable.
After this I uploaded
linpeas to the target machine and executed. Linpeas soon picking up the binary
php7.2 has the SUID bit set.
Checking GTFOBins for SUID exploits we see the following:
Using this information I ran the following command to gain shell as root.