type
Post
status
Published
date
Mar 5, 2026
slug
buuctf-web-41-60
summary
BUUCTF平台刷题笔记-WEB
tags
CTF
WEB
category
CTF
icon
password

41-45

41. [NCTF2019]Fake XML cookbook

前置知识:
该函数可以读取xml
无回显攻击流程:
  1. 先调用%dtd,请求远程服务器(攻击服务器)上的evil.dtd。
  1. 再调用 evil.dtd中的 %file。%file 获取受攻击的服务器上面的敏感文件,然后将 %file 的返回结果传到%send 。
  1. 然后调用 %send; 把读取到的数据发送到远程服务器上。
 
对输入进行抓包,如下图
notion image
根据题目提示,猜测是XML注入,构造如下payload
重新发包后得到flag
notion image

42. [GWCTF 2019]我有一个数据库

进入靶场,是乱码
notion image
使用bp抓包,没有发现什么有用的信息
notion image
使用dirsearch扫描网站
dirsearch -u http://0d1bd4dc-16a1-4d36-81e9-c272439c6529.node5.buuoj.cn:81/ -x 429 -i 200,403 -t 5
notion image
访问robots.txt,结果如下:
notion image
然后根据目录扫描结果再访问phpmyadmin
notion image
在上图界面右下角可以看到phpmyadmin的版本是4.8.1,该版本存在漏洞
构造payload:
target=db_export.php%253f/../../../../../../../../etc/passwd
notion image
这说明LFI执行成功,接下来尝试访问flag
target=db_export.php%253f/../../../../../../../../flag
notion image

43. [BJDCTF2020]Mark loves cat

使用dirsearch进行目录扫描
notion image
发现有git,想到使用githack工具
使用工具拿到源码
notion image
其中flag.php的内容如下
index.php中重要内容如下
代码中第一个foreach,可以使用post的任何键名来覆盖同名变量,比如post里面有a=123就会执行$a=123
第二个foreach:GET里每一对x=y,都会让变量$x的值 = 变量$y的值。
第三个foreach:如果 $_GET['flag'] 的值严格等于某个参数名$x,并且这个参数名不是 'flag',就直接 exit($handsome);
然后判断GET和POST是否都没有传入flag,如果没有就退出
最后判断变量flag的值是否等于flag,如果等于就退出。
如果均绕过上述限制,就输出真正的flag
 
上面多个exit可以使用变量覆盖输出flag的内容,对于第一个exit。其思路如下:
  • handsome=flag$handsome变量值变成$flag(真 flag)
  • 再用 flag=handsome$_GET['flag']等于"handsome"
  • 触发第三段循环的条件,提前exit($handsome),于是把真flag打出来
最后构造payload:?handsome=flag&flag=handsome
执行后得到flag
notion image

44. [WUSTCTF2020]朴实无华

扫描目录发现robots.txt,访问结果如下
notion image
访问该php,发现响应头中有提示
notion image
访问该文件后拿到源码
level1-intval()绕过
intval函数,此函数在处理数据时会在接触到字符串时停止,因此如果输入100e2之类的数据,会解释称100,但后面在执行+1时,100e2是解释称10000的,因此此处使用科学技术法绕过。
level2-md5绕过 思路就是通过找到一个0e开头的值,且md5加密后的内容也是0e开头的,使得条件为真。那么找到了满足条件的值:0e215962017
level3-str_ireplace绕过
先用ls命令查看文件目录
notion image
然后使用%09绕过空格拿到flag:?num=1e5&md5=0e215962017&get_flag=tac%09fllllllllllllllllllllllllllllllllllllllllaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag
notion image

45. [BJDCTF2020]Cookie is so stable

考点是SSTI的Twig模板注入
notion image
各种语言发生ssti注入的模版
输入{{7*‘7’}},返回49表示是Twig模块
输入{{7*‘7’}},返回7777777表示是Jinja2模块
notion image
该模版有通用的payload{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}} 这里的id可以替换为任意代码
notion image
payload的输入位置在POST请求中的Cookie,在PHPSESSID后添加user字段
notion image
 
BUUCTF刷题笔记(WEB)21-40论文精读
Loading...