提示:
找到注册的加密函数->主动调用->逐字节爆破密文
这道题题的分析过程:
先把网站映射到本地端口:
python -m http.server 8888
这样就可以用浏览器来进行调试了!
浏览器访问:127.0.0.1:8888 就可以访问这个页面并且进行调试了!
成功获得flag:
当然这样是不够的要去看代码QAQ
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<script src="static/wasm_exec.js"></script>
<script>
const go = new Go();
WebAssembly.instantiateStreaming(fetch("static/main.wasm"), go.importObject)
.then((result) => go.run(result.instance));
function check_flag() {
var flag = document.getElementById("flag").value;
console.log("你输入的 flag 是:");
console.log(flag);
if (document.getElementById("flag").value === "flag{this_1s_fake_f_l_A__g}") {
console.log("I have a gift for you!");
console.log(console.gift("ABCCDDEE", "AABBCCDDEE"));
alert("恭喜你,答对了!我想你应该知道 flag 是什么了 !");
} else {
alert("答错了,再想想吧!");
}
}
</script>
<body>
<input id="flag" type="text" />
<button id="btn" onclick="check_flag();" >Click</button>
</body>
</html>
分析发现这里的check_flag是假的,flag不在这里!!
继续分析发现了:
const go = new Go();
WebAssembly.instantiateStreaming(fetch("static/main.wasm"), go.importObject)
.then((result) => go.run(result.instance));
解释一下代码:
fetch("static/main.wasm")
fetch
函数从指定的 URL ("static/main.wasm"
) 获取 WebAssembly 文件
fetch
返回一个Promise
,它解析为响应对象(Response
)。
WebAssembly.instantiateStreaming(fetch("static/main.wasm"), go.importObject)
WebAssembly.instantiateStreaming
是一个高效的加载和编译 WebAssembly 模块的方法。- 它接收两个参数:
- 第一个参数是
Response
对象,这里通过fetch("static/main.wasm")
获得。 - 第二个参数是导入对象(
go.importObject
),它包含 WebAssembly 实例需要的导入值。
- 第一个参数是
instantiateStreaming
返回一个Promise
,解析为一个包含已编译 WebAssembly 模块的对象。
.then((result) => go.run(result.instance));
then
方法注册一个回调函数,该函数在Promise
解析时执行。- 回调函数接收一个
result
对象,该对象包含已实例化的 WebAssembly 模块实例(result.instance
)。 - 调用
go.run(result.instance)
运行 WebAssembly 模块。
然后就可以去浏览器看看具体的wasm代码了!按f12
调试的时候会发现存在无限debugger QAQ
我绕不过去!!!