Remote code execution via web shell upload
Last updated
Last updated
This lab contains a vulnerable image upload function. It doesn't perform any validation on the files users upload before storing them on the server's filesystem.
To solve the lab, upload a basic PHP web shell and use it to exfiltrate the contents of the file /home/carlos/secret
. Submit this secret using the button provided in the lab banner.
You can log in to your own account using the following credentials: wiener:peter
.
This lab proved to be quite straightforward. Upon logging in, I decided to explore the upload functionality. With the proxy set up to monitor all requests, I attempted to upload an image. However, upon reviewing the request history in Burp Suite, I couldn't locate where the image was being uploaded. To pinpoint the issue, I enabled the Images checkbox in the Filter settings dialog of the filter bar as you can see below:
This adjustment revealed a new request, a GET request to /files/avatars/<UPLOADED-FILE> . Now armed with the knowledge of the file upload location, I crafted a simple PHP script named shell.php:
By uploading this webshell and navigating to , I successfully accessed the content of the /home/carlos/secret file, thereby resolving the lab.