第11题

wasm加密

抓包,加密参数为m

image-20260113155917464

因为_ts参数比较特殊,直接搜索就行,全部打上断点,重新请求

image-20260113160013760

image-20260113160107215

可以找到加密点

实际加密函数为:let f = d[O(0x92, 'PtOP')](callEncryptFunction, c, e);

image-20260113160207885

进一步发现加密函数为

image-20260113163430904

断点进去发现为wasm加密

image-20260113163522697

wasm是啥呢

image-20260113163741197

这是百度的解释

方式一:我们直接用ai帮我们把wasm改写为js代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// 纯粹的JavaScript实现,不依赖WebAssembly API
class SimpleWasmEmulator {
constructor() {
// 使用ArrayBuffer模拟内存
this.memoryBuffer = new ArrayBuffer(256 * 65536); // 16MB
this.memoryView = new DataView(this.memoryBuffer);
this.stackPointer = 5243920;
}

// "加密"函数 - 实际上只是一个简单的数学运算
encrypt(input1, input2) {
// 模拟 i32.div_s(有符号32位整数除法)
const division = Math.trunc(input2 / 3);

// 注意:WASM中的整数是32位有符号的,需要处理溢出
const result = (input1 + division + 16358) | 0; // 使用按位或0强制转换为32位

return result;
}

// 内存分配函数
allocateMemory(size) {
// 对齐到16字节
const alignedSize = (size + 15) & ~15;

// 检查是否有足够内存
if (this.stackPointer - alignedSize < 0) {
throw new Error("栈溢出");
}

this.stackPointer -= alignedSize;
return this.stackPointer;
}

// 获取当前栈指针
getStackPointer() {
return this.stackPointer;
}

// 设置栈指针
setStackPointer(pointer) {
this.stackPointer = pointer;
}
}

// 使用示例
const emulator = new SimpleWasmEmulator();
console.log("加密结果(10, 9):", emulator.encrypt(10, 9)); // 16371
console.log("加密结果(0, 0):", emulator.encrypt(0, 0)); // 16358

image-20260113163914925

一致

image-20260114110232494

更多内容也在公众号更新:码字的秃猴

tuhou