An open API service indexing awesome lists of open source software.

https://github.com/probiusofficial/php-filterchain-exploit

A Online PHP FilterChain Generator.
https://github.com/probiusofficial/php-filterchain-exploit

Last synced: over 1 year ago
JSON representation

A Online PHP FilterChain Generator.

Awesome Lists containing this project

README

          

# PHP-FilterChain-Exploit
A Online PHP FilterChain Generator:https://probiusofficial.github.io/PHP-FilterChain-Exploit/

Used in [【PHPinclude-labs · level 16: FilterChain:THE_END_OF_LFI】](https://github.com/ProbiusOfficial/PHPinclude-labs/tree/main/Level%2016) to simplify the generation process.

idea:https://gist.github.com/loknop/b27422d355ea1fd0d90d6dbc1e278d4d

Modified from:

- https://github.com/wupco/PHP_INCLUDE_TO_SHELL_CHAR_DICT/

- https://github.com/synacktiv/php_filter_chain_generator/

## Detail

> 在开始之前,请先参阅 [【PHP手册 · wrappers · php://filter】](https://www.php.net/manual/zh/wrappers.php.php#wrappers.php.filter).
>
> 如果你无法理解,可以尝试完成 [【PHPinclude-labs】](https://github.com/ProbiusOfficial/PHPinclude-labs) 中的 【Level 6】 【Level 8】 【Level 9】【Level 11】【Level 11-】【Level 11
>
> +】
>
> php:// — 访问各个输入/输出流(I/O streams)

php://filter - (PHP_Version>=5.0.0)其参数会在该协议路径上进行传递,多个参数都可以在一个路径上传递,从而组成一个过滤链,常用于数据读取。

| 名称 | 描述 | 示例 |
| ------------------------- | ------------------------------------------------------------ | -------------------- |
| resource=<要过滤的数据流> | 这个参数是必须的。它指定了你要筛选过滤的数据流。 | `resource=flag.php` |
| read=<读链的筛选列表> | 该参数可选。可以设定一个或多个过滤器名称,以管道符(\|)分隔。 | `php://filter/read=A\|B\|C/resource=flag.php` |
| write=<写链的筛选列表> | 该参数可选。可以设定一个或多个过滤器名称,以管道符(\|)分隔。 | `php://filter/write=A\|B\|C/resource=flag.php` |
| <;两个链的筛选列表> | 任何没有以 read= 或 write= 作前缀 的筛选器列表会视情况应用于读或写链。 | `php://filter/A\|B\|C/resource=flag.php` |

我们以 `convert.iconv` 的 `CSISO2022KR` 为例子,看下面的这一串php代码:

```
php://filter/convert.iconv.UTF8.CSISO2022KR/resource=php://temp
```

我们尝试输出它:

```PHP

```

我们只需要构造他的base64形式的反转形式最后解码,就能在字符串前端生成我们的payload了

```
PD89YCRfR0VUWzBdYDs7Pz4=` ——> `4zP7sDYdBzWUV0RfRCY98DP
```

在了解基本原理之后,我们要做的就是使用编码构造一份字典,对应base64编码中每一个合法字符:https://github.com/wupco/PHP_INCLUDE_TO_SHELL_CHAR_DICT