-
-
[原创]看雪CTF.TSRC 2018 团队赛 第四题 盗梦空间 WP
-
发表于: 2018-12-19 14:53 3060
-
看雪CTF.TSRC 2018 团队赛 第四题 盗梦空间 验证点: .text:00401671 push 0DEADBEEFh .text:00401676 lea eax, [ebp+var_44] .text:00401679 push eax .text:0040167A push 0DA8A0600h .text:0040167F push 172442D7h .text:00401684 push 4914B2B9h .text:00401689 push 7380166Fh .text:0040168E push 10325476h .text:00401693 push 98BADCFEh .text:00401698 push 0EFCDAB89h .text:0040169D push 67452301h .text:004016A2 mov ecx, [ebp+var_1DC] .text:004016A8 push ecx .text:004016A9 lea edx, [ebp+var_1D0] .text:004016AF push edx .text:004016B0 call sub_401C70 .text:004016B5 add esp, 30h .text:004016B8 mov eax, 0CABD4891h .text:004016BD mov eax, 0DADBACEAh .text:004016C2 call ds:IsDebuggerPresent .text:004016C8 test eax, eax .text:004016CA jz short loc_40171C .text:004016CC call sub_463120 .text:004016D1 mov eax, 4 .text:004016D6 imul ecx, eax, 0 .text:004016D9 cmp [ebp+ecx+var_1D0], 87654321h .text:004016E4 jnz short loc_401707 .text:004016E6 mov edx, 4 .text:004016EB shl edx, 0 .text:004016EE cmp [ebp+edx+var_1D0], 12345678h sub_401C70函数对输入的两个DWORD解码后得到87654321h,12345678h即可 问题就在于sub_401C70里有大量smc和花指令,只能写程序来解决这个了,代码见附件 去花后整理出的解码函数: void sub_401C70(DWORD *in,DWORD *key,DWORD h0,DWORD h1,DWORD h2,DWORD h3,DWORD h4,DWORD h5,DWORD h6,DWORD h7,DWORD *t,DWORD x) { DWORD v266; DWORD v267; DWORD v268; DWORD v270; DWORD c1; DWORD c0; c0 = in[0]; c1 = in[1]; v268 = key[0]; v270 = key[1]; v267 = key[2]; v266 = key[3]; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0x89ABCDEF) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0x89ABCDEF) ^ (v267 + (c0 << 4)); c0 -= (~h0 + 0x3ECCD87B) << 7; c1 -= (0x548A46D1 - h1) >> 9; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0x13579BDE) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0x13579BDE) ^ (v267 + (c0 << 4)); c0 -= (0xFBB23022 - h2) << 5; c1 -= h6 | ((h3 - 0x100CA839) >> 6); c0 += (v270 + (c1 >> 5)) ^ (c1 + 0x9D0369CD) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0x9D0369CD) ^ (v267 + (c0 << 4)); c0 -= (0xF1E85296 - h3) >> 9; c1 -= (0x8A6F6B3A - h0) << 4; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0x26AF37BC) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0x26AF37BC) ^ (v267 + (c0 << 4)); c0 -= (~h1 - 0x6B9A2D27) << 8; c1 -= 8 * h3 - 0x4B6EA5D0; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0xB05B05AB) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0xB05B05AB) ^ (v267 + (c0 << 4)); c0 -= v270 & ((h2 - 0x1B9E4315) >> 2); c1 -= (0xC2CFE269 - h0) >> 5; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0x3A06D39A) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0x3A06D39A) ^ (v267 + (c0 << 4)); c0 -= (0xD8D8F314 - h6) << 5; c1 -= (0xD4C61A57 - h1) >> 6; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0xC3B2A189) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0xC3B2A189) ^ (v267 + (c0 << 4)); c0 -= (h3 + 0x2077DFE7) >> 8; c1 -= (h1 + 0x2AEDDDFF) << 4; c0 += (v270 + (c1 >> 5)) ^ (c1 + 0x4D5E6F78) ^ (v268 + (c1 << 4)); c1 += (v266 + (c0 >> 5)) ^ (c0 + 0x4D5E6F78) ^ (v267 + (c0 << 4)); in[0] = c0; in[1] = c1; } 最后得到结果: 285764B86F41B019
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
他的文章
谁下载
无
看原图
赞赏
雪币:
留言: