[SECCON CTF 2022] skipinx(学习)
首页长这样
nginx
配置文件
server {
listen 8080 default_server;
server_name nginx;
location / {
set $args "${args}&proxy=nginx";
proxy_pass http://web:3000;
}
}
const app = require("express")();
const FLAG = process.env.FLAG ?? "SECCON{dummy}";
const PORT = 3000;
app.get("/", (req, res) => {
req.query.proxy.includes("nginx")
? res.status(400).send("Access here directly, not via nginx :(")
: res.send(`Congratz! You got a flag: ${FLAG}`);
});
app.listen({ port: PORT, host: "0.0.0.0" }, () => {
console.log(`Server listening at ${PORT}`);
});
尝试过构造参数数组,甚至查过express
和qs
的文档,明明是签到题却没有做出来,属实心态崩了呜呜呜
今天看到油管上有佬放出了wp,发现属实是自己想复杂了
可能是nginx
对参数长度的限制,只要我们构造的url
长度足够长,又不至于引发414
错误,就能把nginx
反代中附加的proxy
参数顶掉
所以payload
为
/?proxy=a&proxy=a&proxy=a...&proxy=a
Edited 受到了大佬的指点,这题当时其实没走偏,具体原理是express
调用的qs
处理参数个数上限为1000个,所以就被顶掉了QwQ,看来要素察觉能力有待加强
#Web #nodejs #express #qs #URL #URI #HTTP #nginx