-
-
[原创]【KCTF2020秋季】【第七题】【鱼目混珠】
-
发表于: 2020-12-2 12:12 5426
-
【KCTF2020秋季】【第七题】【鱼目混珠】
程序里有一些花指令,规则比较简单,可以直接二进制搜素替换,或者为了不影响内存校验不处理。
读取输入:
004B5BF3 8D4424 70 LEA EAX,DWORD PTR SS:[ESP+70]
004B5BF7 C70424 60A64B00 MOV DWORD PTR SS:[ESP],lelfei-K.004BA660
004B5BFE 894424 04 MOV DWORD PTR SS:[ESP+4],EAX
004B5C02 E8 59CBFFFF CALL lelfei-K.004B2760
判断输入长度:
004B5C54 8D43 F3 LEA EAX,DWORD PTR DS:[EBX-D]
004B5C57 83F8 32 CMP EAX,32
004B5C5A 0F87 91010000 JA lelfei-K.004B5DF1
大概是和内存校验相关的两处检查,一时不大好搞,先直接按相等跳过:
004B5DE1 3B7424 1C CMP ESI,DWORD PTR SS:[ESP+1C]
004B5DE5 74 3B JE SHORT lelfei-K.004B5E22
...
004B5E22 A1 48904B00 MOV EAX,DWORD PTR DS:[4B9048]
004B5E27 31F8 XOR EAX,EDI
004B5E29 3B4424 20 CMP EAX,DWORD PTR SS:[ESP+20]
004B5E2D ^75 B8 JNZ SHORT lelfei-K.004B5DE7
前面好多anti检测,我也没搞清楚怎么过,先直奔算法吧:
004B5E55 8D4424 70 LEA EAX,DWORD PTR SS:[ESP+70]
004B5E59 894424 04 MOV DWORD PTR SS:[ESP+4],EAX
004B5E5D E8 2EBDF4FF CALL lelfei-K.00401B90 //对输入做16进制转换
...
004B5ED8 E8 B3C6F4FF CALL lelfei-K.00402590 //x = code * 0x10010401
...
004B5F47 E8 C4C9F4FF CALL lelfei-K.00402910 //x /= 0xE053D0F
...
004B5F7A E8 91C0F4FF CALL lelfei-K.00402010 //x += 0x3FAFFA2B01B6BA9744C4B4E010010401
...
004B5F9B E8 70C0F4FF CALL lelfei-K.00402010 //x += 0xFEA1BD9E6964129D8F5079E1
...
004B5FC2 E8 C9C5F4FF CALL lelfei-K.00402590 //0x3FAFFA2B01B6BA9744C4B4E010010401 * 0xFEA1BD9E6964129D8F5079E1
...
004B5FF8 E8 F3C0F4FF CALL lelfei-K.004020F0 //y = x - 0x3FAFFA2B01B6BA9744C4B4E010010401 * 0xFEA1BD9E6964129D8F5079E1
...
004B6008 833D A4504C00 10 CMP DWORD PTR DS:[4C50A4],10 //大数y不超过16字节
004B600F ^0F8F D2FDFFFF JG lelfei-K.004B5DE7
..
004B6038 E8 53C5F4FF CALL lelfei-K.00402590 //z = x * 0xE053D0F
...
004B60AE E8 DDC4F4FF CALL lelfei-K.00402590 //z *= 0x25
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!