PHP Wrappers
php://input Wrapper
Allows reading raw POST data. Useful when you can control POST body but not GET parameters.
curl -X POST --data "<?php system('id'); ?>" "http://target.com/index.php?page=php://input"curl -X POST --data "<?php system(\$_GET['cmd']); ?>" "http://target.com/index.php?page=php://input&cmd=whoami"zip:// Wrapper
Remote Code Execution
The zip:// stream wrapper can be used in specific attack scenarios to potentially execute malicious code.
First, create the
webshell:
Second,
zipthe file:
Important to mention that the file extension can be different from
.zip, the wrapper will still execute the code inside.Third, upload the file and once is done, use the wrapper:
Have in mind that
%23is the URL encoded version of#and is used to reference a file inside thezip
data:// Wrapper
data:// Wrapper
The data:// wrapper allows you to embed data directly in the URL using data URIs.
Requirements: allow_url_include = On in php.ini
expect:// Wrapper
expect:// Wrapper
The expect:// wrapper allows you to execute system commands directly (rarely enabled).
Requirements: PECL expect extension installed and allow_url_include = On
Custom Filter Chains for RCE (PHP 8.x)
This technique uses filter chains to achieve RCE without using any wrappers or include statements:
Last updated