Challenge Overview
The application exposed:
At first, I performed directory brute-forcing using:
gobuster with common and big wordlists
No interesting endpoints or hidden directories were discovered.
After that, I shifted focus to parameter fuzzing .
Using Burp Intruder with the burp-parameter-names (located in SecsList/Discovery/Web-Content ) wordlist against:
I discovered the hidden parameter :
To better understand input filtering , I wrote a small Python script to determine which characters were blacklisted in ?cmd=:
Copy import requests
import string
url = " http://34.179.171.239:32559/index.php?cmd= "
blacklisted = []
non_blacklisted = []
characters = string . printable
for char in characters :
response = requests . get ( url + char )
if " Try Harder! " in response . text :
blacklisted . append ( char )
else :
non_blacklisted . append ( char )
print ( " bl " , "" . join ( blacklisted ))
print ( " nonbl " , "" . join ( non_blacklisted )) This allowed me to clearly identify which characters triggered the filter and which were allowed , which was crucial for building payloads later.
Initial manual attempts:
However:
Returned:
This confirmed the backend was executing:
This was PHP Code Injection via eval() , not shell command injection.
The key difference:
eval() → executes PHP code
system()/exec() → execute OS shell commands
So exploitation had to be done using PHP functions , not Bash.
Bypassing the Blacklist
From the character testing script, I identified that characters such as:
were blocked.
So direct string usage was impossible.
Solution : construct strings dynamically using chr() + implode()
Example:
Equivalent to:
This bypassed the need for:
Directory Enumeration
Current directory:
Equivalent to:
Output:
Traversal upward:
Eventually reaching /:
Classic container structure.
To read a file:
Equivalent to:
After that, using View Page Source (Ctrl + U) , the flag was found inside a comment in index.php .
Key functions used
Reference for dangerous PHP functions:
https://gist.github.com/mccabe615/b0907514d34b2de088c4996933ea1720arrow-up-right
This was eval injection , not command injection.
In eval contexts, think in PHP primitives , not shell.
implode(array(chr(...))) is a powerful blacklist bypass technique. Like .join in python
scandir() behaves like ls -a.
readfile() outputs directly; file_get_contents() returns a string.
When brute-forcing fails, parameter fuzzing and character analysis can reveal the real attack surface.
made by k0d