bWAPP靶场之PHP Code Injection

0x00 PHP Code Injection

核心代码:

<?php
if(isset($_REQUEST["message"]))
{
    // If the security level is not MEDIUM or HIGH
    if($_COOKIE["security_level"] != "1" && $_COOKIE["security_level"] != "2")
    {
?>
    <p><i><?php @eval ("echo " . $_REQUEST["message"] . ";");?></i></p>
<?php
    }
    // If the security level is MEDIUM or HIGH
    else
    {
?>
    <p><i><?php echo htmlspecialchars($_REQUEST["message"], ENT_QUOTES, "UTF-8");;?></i></p>
<?php
    }
}
?>

1.low
没有对输入的参数进行过滤就直接在eval()函数输出
在这里插入图片描述
2.medium、high
用htmlspecialchars()函数进行了HTML实体编码,没有绕过
在这里插入图片描述

posted @ 2019-12-18 20:28  吃不胖的ruanruan  阅读(487)  评论(0编辑  收藏  举报