Challenge
Collect the characters returned by sequential XMLHttpRequest calls.
收集连续 XMLHttpRequest 请求返回的 flag 字符。
https://webhacking.kr/challenge/bonus-14/Analysis
页面脚本从 m=0 开始依次请求 ?m=i,每个响应只包含当前字符。原脚本用 innerHTML = responseText 覆盖前一个字符,所以页面上直接观察时只能看到最后一次响应。把响应追加到一个字符串,或者在 Network 面板逐个读取 response body,就能重建字符流。
Solution
在已登录 old-54 页面中运行以下完整浏览器脚本。它保持 same-origin session,按顺序请求每个索引,打印单字符响应,并在空响应或题目使用的 ? 终止响应出现时停止:
(async function collectOld54() { const endpoint = "/challenge/bonus-14/"; let result = "";
for (let index = 0; index < 128; index += 1) { const response = await fetch(`${endpoint}?m=${index}`, { credentials: "same-origin", cache: "no-store" }); const character = await response.text(); console.log(index, JSON.stringify(character));
if (character === "" || character === "?") { break; }
result += character; }
console.log("collected:", result); return result;})();如果直接修改题目原脚本,关键赋值必须从覆盖改为追加:
aview.innerHTML += x.responseText;