[Day 6] Patch Management Is Hard

{Web Exploitation = LFI}

Challenge

Accessing the webserver returns the following.

Inspecting the URL revealed that the application was invoking the error message from a given file.

Replacing the error file with /etc/passwd seemed to return the file and confirm the LFI vulnerability.

Next, to get the source code of a particular file, I used the PHP filter method as shown below.

Decoding the base64 value then led me to the next flag.

In the source code, I noticed that there is a file called creds.php and manage.php

manage.php redirects to login.php. This is where the creds.php comes in handy. I used the same filter technique to read the contents of the creds.php file.

Logging into the Control System and accessing Password Recovery reveals the next flag.

Now that I had access to logs, know where the file is located, and was able to write to the file via web requests, I used the log poisoning method to get remote command execution on the system.

I first poisoned the logs by sending a request with curl and setting a PHP payload as the user agent as shown below. The payload basically allows an attacker to run arbitrary commands remotely, on the server via the browser.

Following that, I invoked the logfile via LFI and simply added a cmd argument in the URL and ran commands on the server.

Last updated

Was this helpful?