配置XSS Bot的Dockerfile
puppeteer
定型文:
1 | FROM node:24-slim |
如果用Node.js中的puppeteer:
1 | WORKDIR /app |
定型文:
1 | FROM node:24-slim |
如果用Node.js中的puppeteer:
1 | WORKDIR /app |
我最喜欢的一道题。
1 | // server.js |
1 | // bot.js |
现在flag就在管理员的邮箱里,具体的说是管理员邮箱里一封邮件的标题。
请读文档:https://fetch.spec.whatwg.org/#http-redirect-fetch
4.5. HTTP-redirect fetch
To HTTP-redirect fetch, given a fetch params fetchParams and a response response, run these steps:
- Let request be fetchParams’s request.
- Let internalResponse be response, if response is not a filtered response; otherwise response’s internal response.
- Let locationURL be internalResponse’s location URL given request’s current URL’s fragment.
- If locationURL is null, then return response.
- If locationURL is failure, then return a network error.
- If locationURL’s scheme is not an HTTP(S) scheme, then return a network error.
- If request’s redirect count is 20, then return a network error.
- Increase request’s redirect count by 1.
- If request’s mode is “cors”, locationURL includes credentials, and request’s origin is not same origin with locationURL’s origin, then return a network error.
- If request’s response tainting is “cors” and locationURL includes credentials, then return a network error.
请看第7条:If request’s redirect count is 20, then return a network error. 当邮件搜索的结果恰好为1封邮件时,服务器会返回一个重定向响应.
那么,What if the attacker redirected their own page 18 times and then redirected it to the victim’s website?

答案是:puppeteer会进入catch分支,返回”Don’t hack my puppeteer.”,那么我们就实现了正误输入的差分。
1 | // exp.js |
1 | // redirector.js |
前排滑跪致歉:对不起给大家喂💩了
出这一题时设想的是出一道AI做不出来的题,如何做不出呢,那自然是token数得多;正好当时在干另外一个事情,就是将一个C代码转为AST,然后解析AST,进行一系列注入标识符替换,运算符提取,控制流展平等等一系列操作,输出一个等价但AST树几乎变样的C代码,用来绕过PTA的检测。
那么就有了这道题:将AST还原为C代码。
降低难度,直接运行还原后的代码会直接输出flag。
为了增加难度(防止根据loc信息直接把源代码还原出来),我们删除了loc,range,name信息,按理来说接下来就是人肉IDA的时间了。
预期的解法是:
然后遇到了这两件事
mangledName,里面存储的是函数/全局变量的原始名字,那这直接看名字就能猜到里面在干什么了还逆个啥啊,导致预期第二种解法难度急剧下降。总而言之这一题确实有点坏心眼在,然后玩的时候没玩好把自己绕进去了,导致出来的就是这么一道意义不明的题目。以后一定注意。
Work in Progress
Work in progress
突然想到了去年学程算时整出来的奇技淫巧,在这里分享一下。
背景:遇到了一些幽默题目,不知道测试数据是什么,有没有办法把它偷出来?
1 | #include <assert.h> |
当n < value时,PTA报错:’运行时错误’(Runtime Error),通过不断调整value的值,可以二分猜出n的值。
1 | #include <time.h> |
通过这种方式,通过评测机输出的“用时”这一栏目,可以偷出data_to_steal的值。