This lab contains a vulnerable image upload function. It attempts to prevent users from uploading unexpected file types, but relies on checking user-controllable input to verify this.
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
Solution
After login as Wiener user there's an upload option to upload avatar image:
with the avatar image at this path/location:
We need to obtain Carlos's secret, we can do it upload a php shell (php_web_shell.php) that get secret file content
there's a filtering and we can't upload php shell, seeing the output message file types allowed are: image/jpeg and image/png, so we can use the Burp Repeater to modify request updating Content-Type
Infact, inserting: image/jpeg we're able to upload our php web shell bypassing controls:
Carlos's Secret
FYw9wjdc53Z6eePuSDiWMPkmrVT6kzvF
Obtaining Carlos's secret and solving the lab.
We know the file location and we can open it going to: