The Challenge
The application has two vulnerabilities that chain together: a file upload that stores files but does not execute them by URL, and a ?page= parameter that includes arbitrary local files with include(). Neither is enough alone — together they give RCE.
Approach
- Upload
GIF89a;\n<?php echo system("/getflag"); ?>as a.phpfile (or with any accepted extension). The file is saved at a known path such asuploads/HASH/filename. - Use the LFI gadget:
?page=uploads/HASH/filenamemakes PHPinclude()the file, which triggers execution of the embedded shell.
The response from the LFI request contains the output of /getflag.
Solution
|
|
|
|
The LFI path uploads/HASH/shell2.php tells PHP to include() it, executing the shell code. /getflag is the flag-printing binary on this challenge instance.
What I Learned
File upload + LFI is a classic server-side exploit chain. Even if uploaded files are not directly served through a PHP-executing route, an LFI allows including them into the PHP runtime. Fix: store uploads outside the web root, sanitise the page parameter to a whitelist, and never allow user-controlled paths in include().