2019年第三届广东省强网杯网络安全大赛WEBwriteup
2019-9-10
| 2024-2-2
0  |  阅读时长 0 分钟
type
status
date
slug
summary
tags
category
icon
password

八卦

本次比赛的一个槽点, 为什么是在星期一二举行咧...
由于我只会一点 web ,所以只解出几道 web 题
Writeby TARITARI

1. Web – 小明又被拒绝了

看到题目很容易想到改http头,于是抓包。一开始直接改cookie: admin=1无效,后来想了下,小明如果是本地人就不会被拒绝啦!于是用到X-Forwarded-For字段,伪造ip为本地地址127.0.0.1。
notion image
提交过去发现不是admin,改好cookie后即可获得flag{xxasdasdd_for}
notion image

2. Web – XX?

看到题目就想到了xxe,先访问网站发现网站的标题为gedit
notion image
notion image
然后网上搜了下发现gedit在写完文件后,默认会产生一个以\~结尾的备份文件名 例如:index.php\~。这可用于从服务器中提取源代码/文件。然后御剑扫描发现有三个文件,于是访问index.php\~得到源码。哦豁,果然是xxe。
notion image
我有一个大胆的想法,flag.php会不会也有呢?
notion image
好吧,没有。那我们继续外部实体注入攻击,结合扫描出来的flag.php,得到base64编码。
notion image
解码可得flag{IUyasd8213123123890}
notion image

3. 免费的,ping一下~

结合题目和页面,是php ping命令执行无误了,ls一下,果然是这样。
notion image
然后尝试ls一下根目录,发现waf过滤敏感字符了。于是测试被过滤掉的是空格还是“/“斜杠。
notion image
结合网上搜一下,得知中有个变量叫IFS(Internal Field Seprator) ,内部域分隔符,即空格。代替原来的成功执行了。
notion image
继续ls得知原来是空格被waf过滤掉了。嘿嘿,那就是可以cat /flag啦,执行以下,然后得知cat 或flag关键字又被过滤了。
notion image
由于我偶尔会编写shell脚本,想到用变量拼接可以绕过关键字的过滤。然后一顿猛如虎的操作,结果被告知flag不在第一行。而且他只能显示部分内容。。。
notion image
最后使用tail -n 1 /flag 成功获取flag{llllll_U_GeT_Th3_fl4g}
notion image

4. php

访问页面得到一个apache的欢迎页面,于是直接用御剑扫,得到三个文件
notion image
访问index.php得知本题为条件绕过型题目。第一眼看过去整个人傻了,无数字字母还好说,可以用异或^,左右移等等去绕过。然后发现取反和自增可以绕过,但是长度只有27,太苛刻了。
notion image
于是想到,如果这个是php7,那么就可以利用php7的新特性,即可以通过($function)();的方式动态执行函数。 https://www.php.net/manual/zh/migration70.incompatible.php
notion image
取反\~符号可以把字母数字符号等等变为不可见字符,就可以轻松绕过正则了,为了被成功解析,使用urlencode一下。
先copy下来,本地测试,注释掉错误回显,方便调试。先试试phpinfo测试一下,通过 echo urlencode(\~”phpinfo”)构造一下。
notion image
加上(\~exp)(); 试试,就发现可以在题目环境中成功执行,接下来就简单了。
notion image
构造 GetYourFlag调用GetYouFlag()
notion image
notion image
OK,接下来
notion image
最后发现flag{3904c5df2e894ca02a21004feb21e617} 在源码中。
notion image
  • CTF比赛
  • django踩坑记wordpress后台登录密码前端js加密+php后端解密
    • GitTalk
    目录