[RE] JustRe - n3w xp0int Posted on May 27 2019 1、程序为32位: ```bash $file JustRe.exe JustRe.exe: PE32 executable (console) Intel 80386, for MS Windows ``` 2、程序主要逻辑: 输入为26个字符,过两个check即可得到flag: ![title](https://leanote.com/api/file/getImage?fileId=5ceb6d8eab64412e23001b52) 3、check1: 对前`8`个字符转成4字节16进制: ![title](https://leanote.com/api/file/getImage?fileId=5ceb6d8eab64412e23001b50) 对第`9`、`10`个字符同样转成1字节16进制。 4、利用转换后的两个数对一数组进行操作,要求操作完的结果与固定值(loc_404148)的值相等: 数组如下: ![title](https://leanote.com/api/file/getImage?fileId=5ceb6d8eab64412e23001b4f) 操作如下: ![title](https://leanote.com/api/file/getImage?fileId=5ceb6d8eab64412e23001b53) 可知17~24个dword的值操作时会用上输入的前10个字符,提取xmmword_405018和loc_404148的值后,直接用z3即可跑出前10个字符的结果,脚本如下: ```python from z3 import * a = [0x83ec8b55, 0xec81f0e4, 0x278, 0x405004a1, 0x89c43300, 0x2742484, 0x100f0000, 0x4041a805, 0x41c0a000, 0xf560040, 0x2c244411, 0x7e0ff357, 0x4041b805, 0xd60f6600, 0xf402444, 0x6a0a4110, 0x24448840, 0x24848d4c, 0x1fc, 0xf50006a, 0x1c244411, 0xf58e8, 0x8d406a00, 0x2482484] b = [0x78B09135, 0xE78DBAE5, 0xFB0C084A, 0x3B5C0EA2, 0x82C7F904, 0xF937EE81, 0xEB130A06, 0x3B4D7202, 0x3ACC6A08, 0x45A0A49, 0x26E84E1B, 0x5513B95C, 0x3B4D8209, 0xAD132C0D, 0x44BEE4A, 0x61164B1, 0x1F489250, 0x1F88974D, 0xFB0C0BBE, 0x45C0A29, 0xF6E84E25, 0xFB1362AD, 0x864C3016, 0xF953EE93, ] s = Solver() v3 = BitVec('v3', 64) v11 = BitVec('v11', 64) s.add(v11 < 256) s.add(v11 >= 0) s.add(v3 < 0xffffffff) for x in range(16, 24): s.add(((b[x] + v11 * 0x1010101) & 0xffffffff) ^ (x + v3) == a[x]) if (s.check() == sat): v3 = s.model()[v3].as_long() v11 = s.model()[v11].as_long() print(hex(v3)[2:] + hex(v11)[2:]) ``` 可得出前10个字符:`1324221818` 5、check2 对后16个字符补齐24个字节,对每8个字节进行3DES加密,三个密钥分别为: `AFSAFCED`、`YCXCXACN`、`DFKDCQXC` 加密结果与3个定值比较: ![title](https://leanote.com/api/file/getImage?fileId=5ceb6d8eab64412e23001b51) 只比较前2个结果,进行3DES解密即可得到输入的后16个字符,脚本如下: ```python from pyDes import * d = triple_des('AFSAFCEDYCXCXACNDFKDCQXC') p = d.decrypt(b'\xFA\xCE\x09\x87\xE6\xA9\x7C\x50'[::-1] + b'\x6C\x97\xBB\x90\xCF\x0D\xD5\x20'[::-1]) print('flag{1324221818%s}' % p.decode()) ``` 即可得flag: `flag{13242218180dcc509a6f75849b}` 打赏还是打残,这是个问题 赏 Wechat Pay Alipay [Web] 高明的黑客 - LanceaKing [Pwn] trywrite -cpt.shao
没有帐号? 立即注册