Post

Include

Use your server exploitation skills to take control of a web app

Include

image-1868

Questions

image-1869


Reconnaissance

image-1874

Ports 4000 and 50000 use the http protocol (web application), so let’s start recon from these two ports.

image-1876

image-1878


Get Admin Access

We can log in using guest/guest credentialsimage-1880

and this profile page shows something interesting. I try to input a recommended activityimage-1881

and it adds it to the detailsimage-1882

Then I try to modify the value, and it works. This means the website is vuln to property pollution.

image-1883

So, it allows me to change the isAdmin value to true. image-1885


Find Credentials Through the API

After we change from guest to admin, we now have access to the API and Setting pages. image-1886 It provides a secret key = supersecretKey123

and also provides a username for another website.

image-1887

I found the setting page takes a url input, so let’s try to put the api we got here.

image-1888

It gives us a base64 value. Let’s decode this first. image-1889


Login and Get the First Flag

And now we got the credentials for both ReviewAppUser and SysMonAppUsername, which is another website, so let’s try logging in with these credentials.

image-1872 image-1890

And we are in! and got the first flag!


Path Traversal and File Inclusion

Next, I use gobuster to discover hidden paths

image-1873

We found nothing much.

image-1891

Then I found this path whose url uses the img=profile.php parameter, where we may try path traversal

I try many variants of path traversal, and I finally get the right way.image-1892

This allows us to look at the /var/log/auth.log file.

image-1893


Log Poisoning and Command Execution

image-1894

We can see “Hello from Attacker” in the log. This shows that data we send to SSH gets written into the file we can include.

This shows the log from the connection.

So, next I will try to execute an OS command, and let’s see the output from the log

image-1895

image-1896

The PHP payload in the log runs when the page includes it, and we get the output of id as www-data. So, this is log poisoning through the file inclusion.

As you can see, we successfully execute the command.


Get the Last Flag

So, now let’s do ls /var/www/html

image-1897

And we found our flag file!

image-1898

image-1899

Get the flag!

DONE!!!


This post is licensed under CC BY 4.0 by the author.