ctfshow web115(is_numeric绕过+相等==而又不相等!==)

function filter($num){
    $num=str_replace("0x","1",$num);
    $num=str_replace("0","1",$num);
    $num=str_replace(".","1",$num);
    $num=str_replace("e","1",$num);
    $num=str_replace("+","1",$num);
    return $num;
}
$num=$_GET['num'];
if(is_numeric($num) and $num!=='36' and trim($num)!=='36' and filter($num)=='36'){
    if($num=='36'){
        echo $flag;
    }else{
        echo "hacker!!";
    }
}

知识点就一个 is_numeric 函数的绕过:

在数字的前面加上%09 %0a %0b %0c %0d任意一个都可以使其为真不影响判断。

 

关于trim函数看下图:

看一看到%0c没有被过滤,因此payload如下:

?num=%0c36

 

下面还有一个重点:为什么上面的payload也能过

$num == 36 and $num !== 36

 

直接看文档:

这下应该明白了吧!

 

posted @ 2022-10-18 19:18  hithub  阅读(706)  评论(0)    收藏  举报