南邮 ctf wp

1.

<?php
$pass=@$_POST['pass'];
$pass1=***********;//被隐藏起来的密码
if(isset($pass))
{
if(@!strcmp($pass,$pass1)){
echo "flag:nctf{*}";
}else{
echo "the pass is wrong!";
}
}else{
echo "please input pass!";
}
?>


嗯给了代码我们就直接看代码,这里直接就发现了strcmp函数,字符串比较函数,一般形式为strcmp(字符串1,字符串2)。
参考:https://zhidao.baidu.com/question/454871865.html
但是他也有个漏洞就是给他传个数组会返回NULL就是相当于0,tip:strcmp(array,string)=null=0
那就直接构造pass[]=0

flag:nctf{strcmp_is_n0t_3afe}

2.

<?php
 function noother_says_correct($number)
{
        $one = ord('1');
        $nine = ord('9');
        for ($i = 0; $i < strlen($number); $i++)
        {   
                $digit = ord($number{$i});
                if ( ($digit >= $one) && ($digit <= $nine) )
                {
                        return false;
                }
        }
           return $number == '54975581388';
}
$flag='*******';
if(noother_says_correct($_GET['key']))
    echo $flag;
else 
    echo 'access denied';
?>

嗯,这题不是很难,懂一点c语言也是可以做的

在线进制转换:http://tool.oschina.net/hexconvert/
所以构造:

payload:http://chinalover.sinaapp.com/web12/index.php?key=0xccccccccc
注意:转换的时候十六进制要加0x(照顾小白,大牛绕过)

The flag is:nctf{follow_your_dream}


 

猜你喜欢

转载自blog.csdn.net/weixin_42045038/article/details/81410877