php函数
preg_replace \e 模式(PHP 5.5 开始废弃,PHP 7 直接移除)
1 | preg_replace( pattern, string2 replacement, string3 tg, 'limit', 'count'); |
/e 修正符(modifier)是 PHP 的一个特性,使得 preg_replace() 将替换参数 replacement 当作 PHP 代码执行。在匹配到的字符串进行替换时,会先解析替换字符串,然后执行其中的 PHP 代码。
1 | preg_replace('/bad/e', '"g" . (1 - 1 ). (1 - 1) . "d"', "he is a bad boy"); |
攻防世界 ics-05
1 | $pattern = $_GET[pat]; |
使用/e 执行替换时执行replacement 表达式
构造 pat = /test/e & rep = phpinfo() & sub = just test
bool assert(mixed $assertion,string $description])
$assertion 要验证的表达式$description 可选 , 断言失败时输出的自定义描述信息,便于定位问题
攻防世界 mfw
1 |
|
由于assert 会直接执行表达式且 file 变量可控 考虑提前闭合引号注入
构造 ?page=') or phpinfo()