能力值:
( LV9,RANK:170 )
7 楼
刚打开破解时的笔记,发现该段代码已经分析过了:
* Referenced by a CALL at Addresses:
|:00416F95 , :004197B1 , :0041B94D , :0041C818 , :0041FA38
|:0043B3FA , :00443B69 , :0044AFEF , :00450445 , :00456AF4
|:0046480E
|
:00416D40 53 push ebx
:00416D41 56 push esi
:00416D42 81C404F9FFFF add esp, FFFFF904
:00416D48 33DB xor ebx, ebx
:00416D4A 803D081C4C0000 cmp byte ptr [004C1C08], 00 //判断是否执行过
:00416D51 7407 je 00416D5A
:00416D53 B301 mov bl, 01
:00416D55 E9F1010000 jmp 00416F4B
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:00416D51(C)
|
:00416D5A A1DC054C00 mov eax, dword ptr [004C05DC] //获取由Key1计算出的版本号
:00416D5F 6681383A04 cmp word ptr [eax], 043A //判断版本号,应大于此值
:00416D64 730F jnb 00416D75
:00416D66 A1DC054C00 mov eax, dword ptr [004C05DC]
:00416D6B 66833864 cmp word ptr [eax], 0064
:00416D6F 0F85A4010000 jne 00416F19
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:00416D64(C)
|
* Possible Ref to Menu: MenuID_0001, Item: " "
|
:00416D75 6A1C push 0000001C
:00416D77 8D442410 lea eax, dword ptr [esp+10]
:00416D7B 50 push eax
:00416D7C 6800004000 push 00400000
* Reference To: kernel32.VirtualQuery, Ord:0000h
|
:00416D81 E86AF2FEFF Call 00405FF0
:00416D86 54 push esp
* Possible Ref to Menu: MenuID_0001, Item: "Position markieren Strg+I"
|
:00416D87 6A40 push 00000040
:00416D89 8B442420 mov eax, dword ptr [esp+20]
:00416D8D 50 push eax
:00416D8E 8B442418 mov eax, dword ptr [esp+18]
:00416D92 50 push eax
* Reference To: kernel32.VirtualProtect, Ord:0000h
|
:00416D93 E848F2FEFF Call 00405FE0
:00416D98 85C0 test eax, eax
:00416D9A 0F8479010000 je 00416F19
:00416DA0 8D442439 lea eax, dword ptr [esp+39]
:00416DA4 B9C0060000 mov ecx, 000006C0
:00416DA9 8B157CE44B00 mov edx, dword ptr [004BE47C]
:00416DAF E828F9FEFF call 004066DC
:00416DB4 E80BFEFFFF call 00416BC4
:00416DB9 BA0C1C4C00 mov edx, 004C1C0C
:00416DBE 8D442428 lea eax, dword ptr [esp+28]
* Possible Ref to Menu: MenuID_0001, Item: "Sicherung wiederherstellen..."
|
:00416DC2 B910000000 mov ecx, 00000010
:00416DC7 E810F9FEFF call 004066DC
:00416DCC 6A00 push 00000000
:00416DCE 8D4C242C lea ecx, dword ptr [esp+2C]
:00416DD2 8B15F8784000 mov edx, dword ptr [004078F8]
:00416DD8 33C0 xor eax, eax
:00416DDA E8190EFFFF call 00407BF8
:00416DDF 8BF0 mov esi, eax
:00416DE1 6A00 push 00000000
:00416DE3 8D54243D lea edx, dword ptr [esp+3D]
:00416DE7 B9C0060000 mov ecx, 000006C0
:00416DEC 8BC6 mov eax, esi
:00416DEE E8F10EFFFF call 00407CE4
* Possible Ref to Menu: MenuID_0001, Item: "Hex-Werte Strg+Umsch+C"
|
:00416DF3 BA2C000000 mov edx, 0000002C
:00416DF8 8BC6 mov eax, esi
:00416DFA E825B7FEFF call 00402524
:00416DFF 8D442428 lea eax, dword ptr [esp+28]
* Possible Ref to Menu: MenuID_0001, Item: "Sicherung wiederherstellen..."
|
:00416E03 BA10000000 mov edx, 00000010
:00416E08 E8D7F8FEFF call 004066E4
:00416E0D B80C1C4C00 mov eax, 004C1C0C
* Possible Ref to Menu: MenuID_0001, Item: "Sicherung wiederherstellen..."
|
:00416E12 BA10000000 mov edx, 00000010
:00416E17 E8C8F8FEFF call 004066E4
:00416E1C 8D442408 lea eax, dword ptr [esp+08]
:00416E20 50 push eax
:00416E21 68C0060000 push 000006C0
:00416E26 8D442441 lea eax, dword ptr [esp+41]
:00416E2A 50 push eax
:00416E2B A17CE44B00 mov eax, dword ptr [004BE47C]
:00416E30 50 push eax
* Reference To: kernel32.GetCurrentProcess, Ord:0000h
|
:00416E31 E892EFFEFF Call 00405DC8
:00416E36 50 push eax
* Reference To: kernel32.WriteProcessMemory, Ord:0000h
|
:00416E37 E8DCF1FEFF Call 00406018
:00416E3C 85C0 test eax, eax
:00416E3E 0F84D5000000 je 00416F19
:00416E44 817C2408C0060000 cmp dword ptr [esp+08], 000006C0
:00416E4C 0F85C7000000 jne 00416F19
* Possible Ref to Menu: MenuID_0001, Item: "einf?en... Strg+V"
|
:00416E52 6A20 push 00000020
:00416E54 A1E8094C00 mov eax, dword ptr [004C09E8]
:00416E59 50 push eax
:00416E5A 8D442441 lea eax, dword ptr [esp+41]
:00416E5E 50 push eax
* Reference To: kernel32.lstrcpynA, Ord:0000h
|
:00416E5F E80CF2FEFF Call 00406070
:00416E64 8D442428 lea eax, dword ptr [esp+28]
* Possible Ref to Menu: MenuID_0001, Item: "Sicherung wiederherstellen..."
|
:00416E68 BA10000000 mov edx, 00000010
:00416E6D E872F8FEFF call 004066E4
* Possible StringData Ref from Data Obj ->"Offset"
|
:00416E72 8B151C054C00 mov edx, dword ptr [004C051C]
:00416E78 8D442428 lea eax, dword ptr [esp+28]
:00416E7C E8A31C0A00 call 004B8B24
:00416E81 6A00 push 00000000
:00416E83 8D4C242C lea ecx, dword ptr [esp+2C]
:00416E87 8B15F8784000 mov edx, dword ptr [004078F8]
:00416E8D 33C0 xor eax, eax
:00416E8F E8640DFFFF call 00407BF8
:00416E94 8BF0 mov esi, eax
:00416E96 6A00 push 00000000
:00416E98 8D54243D lea edx, dword ptr [esp+3D]
* Possible Ref to Menu: MenuID_0001, Item: "einf?en... Strg+V"
|
:00416E9C B920000000 mov ecx, 00000020
:00416EA1 8BC6 mov eax, esi
:00416EA3 E83C0EFFFF call 00407CE4
* Possible Ref to Menu: MenuID_0001, Item: "Hex-Werte Strg+Umsch+C"
|
:00416EA8 BA2C000000 mov edx, 0000002C
:00416EAD 8BC6 mov eax, esi
:00416EAF E870B6FEFF call 00402524
:00416EB4 8D442428 lea eax, dword ptr [esp+28]
* Possible Ref to Menu: MenuID_0001, Item: "Sicherung wiederherstellen..."
|
:00416EB8 BA10000000 mov edx, 00000010
:00416EBD E822F8FEFF call 004066E4
:00416EC2 8D442439 lea eax, dword ptr [esp+39]
:00416EC6 BAC0060000 mov edx, 000006C0
:00416ECB E814F8FEFF call 004066E4
:00416ED0 8D442404 lea eax, dword ptr [esp+04]
:00416ED4 50 push eax
:00416ED5 8B442404 mov eax, dword ptr [esp+04]
:00416ED9 50 push eax
:00416EDA 8B442420 mov eax, dword ptr [esp+20]
:00416EDE 50 push eax
:00416EDF 8B442418 mov eax, dword ptr [esp+18]
:00416EE3 50 push eax
* Reference To: kernel32.VirtualProtect, Ord:0000h
|
:00416EE4 E8F7F0FEFF Call 00405FE0
:00416EE9 8B442418 mov eax, dword ptr [esp+18]
:00416EED 50 push eax
:00416EEE 8B442410 mov eax, dword ptr [esp+10]
:00416EF2 50 push eax
* Reference To: kernel32.GetCurrentProcess, Ord:0000h
|
:00416EF3 E8D0EEFEFF Call 00405DC8
:00416EF8 50 push eax
* Reference To: kernel32.FlushInstructionCache, Ord:0000h
|
:00416EF9 E8AAEEFEFF Call 00405DA8
:00416EFE A17CE44B00 mov eax, dword ptr [004BE47C]
:00416F03 05C0060000 add eax, 000006C0
:00416F08 48 dec eax
:00416F09 803800 cmp byte ptr [eax], 00
:00416F0C 750B jne 00416F19
:00416F0E C605081C4C0001 mov byte ptr [004C1C08], 01 //记录已执行过
:00416F15 B301 mov bl, 01
:00416F17 EB32 jmp 00416F4B
* Referenced by a (U)nconditional or (C)onditional Jump at Addresses: // 无效“user.txt”
|:00416D6F(C), :00416D9A(C), :00416E3E(C), :00416E4C(C), :00416F0C(C)
|
* Possible StringData Ref from Data Obj ->"f4?dYy.?@"
|
:00416F19 A110074C00 mov eax, dword ptr [004C0710] //"user.txt"
:00416F1E E8B1B60900 call 004B25D4
:00416F23 A1A00A4C00 mov eax, dword ptr [004C0AA0] //AppPath & "user.txt"
:00416F28 E86BB30900 call 004B2298 //判断“user.txt”是否存在
:00416F2D 84C0 test al, al
:00416F2F 7407 je 00416F38 //不存在则跳
:00416F31 E8EE5D0900 call 004ACD24 //显示无效user.txt,不执行操作
:00416F36 EB13 jmp 00416F4B
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:00416F2F(C)
|
:00416F38 66B8D500 mov ax, 00D5
:00416F3C E8EF3F0900 call 004AAF30 //调用资源字符串:Please check the path and your access rights.
* Possible Reference to Menu: MenuID_0001
|
:00416F41 BA01000000 mov edx, 00000001
:00416F46 E8C5AC0900 call 004B1C10 //显示消息(Please...)
* Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
|:00416D55(U), :00416F17(U), :00416F36(U)
|
:00416F4B 8BC3 mov eax, ebx
:00416F4D 81C4FC060000 add esp, 000006FC
:00416F53 5E pop esi
:00416F54 5B pop ebx
:00416F55 C3 ret
不知版主所指示的是这段代码吗?我在这里并不能找到全部的算法信息。还请说明。
能力值:
(RANK:20 )
11 楼
计算decryption key的代码确实是比较繁琐,但其实不复杂。
f基本上分两步:
1、利用user/addr1/addr2/key1计算出一个密钥SubCryptKey。
SubCryptKey = g(user/addr1/addr2/key1);
2、然后用密钥SubCryptKey对key2进行解密就得到decryption key了。
decryption key = decrypt(SubCryptKey, key2);
step 1不需要求逆,只有2才需要求一下逆。
step 2的逆是: key2 = encrypt(SubCryptKey, decryption key);
decryption key是必须根据正版的user.txt在内存里得到的,这也是为什么必须要有个合法的key才能写keygen的原因。encrypt( )是要根据decrypt( )自己写出来的一个函数。
下面的这个比较是检查解密出来的6C0个字节的最后一个字节是否为0,不是0说明decryption key不正确从而user.txt错误,否则就跳过后面的所有代码了。
:00416EFE A17CE44B00 mov eax, dword ptr [004BE47C]
:00416F03 05C0060000 add eax, 000006C0
:00416F08 48 dec eax
:00416F09 803800 cmp byte ptr [eax], 00
:00416F0C 750B jne 00416F19
能力值:
( LV9,RANK:170 )
12 楼
由顶文的注册信息,计算得到的SubCryptKey是这个吗?
17 2D 7D 9E 2D 34 7C D6 B4 F6 94 E4 71 E1 C4 DA
函数decrypt( )就是“CALL 00407CE4”,ESP处存放的是上面的SubCryptKey,EDX处就是Key2,是这样对吧?
也就是说现在要把“CALL 00407CE4”绝对搞懂写出其逆函数?
00416CF6 |. 6A 00 PUSH 0 ; /Arg1 = 00000000
00416CF8 |. 8D4C24 04 LEA ECX,DWORD PTR SS:[ESP+4] ; |17 2D 7D 9E 2D 34 7C D6 B4 F6 94 E4 71 E1 C4 DA
00416CFC |. 8B15 F8784000 MOV EDX,DWORD PTR DS:[4078F8] ; |WinHex.00407904 53 56 83 C4 E8 88 54 24 04 89 04 24 B1 10 B8 FC
00416D02 |. 33C0 XOR EAX,EAX ; |
00416D04 |. E8 EF0EFFFF CALL WinHex.00407BF8 ; \WinHex.00407BF8
00416D09 |. 8BD8 MOV EBX,EAX
00416D0B |. 6A 00 PUSH 0 ; /Arg1 = 00000000
00416D0D |. BA 0C1C4C00 MOV EDX,WinHex.004C1C0C ; |Key2
00416D12 |. 8BC3 MOV EAX,EBX ; |
00416D14 |. B9 10000000 MOV ECX,10 ; |
00416D19 |. E8 C60FFFFF CALL WinHex.00407CE4 ; \WinHex.00407CE4 加解密字符串
谢版主花精力为我解答。
附废话一句:要去上班了,只能到回来后睡醒再分析了,恐怖的是要上二十个小时班(夜班 + 白班)。
能力值:
( LV9,RANK:170 )
14 楼
我之前局部分析过个“CALL 00407CE4”,在程序一开始运行时就多次调用,用来解密一些字符串。分析时遇到一些乘法汇编命令,如:
IMUL CX,DX //CX会取CX与DX乘积的最后四位
对于这种情况,得到CX的结果会是唯一的吗?如何求其逆运算呢?
举个例子吧:
已知:CX=F6C7, DX=4E35
由“IMUL CX,DX”求得:CX=B933
那么,已知CX=B933, DX=4E35,能求出原来的CX吗?
就是说对那个“CALL 00407CE4”求逆算的话,与此应该相关吧?
这个“CALL 00407CE4”内会涉及一个子子CALL,正算容易,反算好像不容易:
00407A6C /$ 53 PUSH EBX
00407A6D |. 56 PUSH ESI
00407A6E |. 51 PUSH ECX
00407A6F |. 66:8B58 02 MOV BX,WORD PTR DS:[EAX+2]
00407A73 |. 66:8B50 04 MOV DX,WORD PTR DS:[EAX+4]
00407A77 |. 66:03DA ADD BX,DX
00407A7A |. 0FB7D2 MOVZX EDX,DX
00407A7D |. 66:8B5450 06 MOV DX,WORD PTR DS:[EAX+EDX*2+6]
00407A82 |. 66:BE 5A01 MOV SI,15A
00407A86 |. 66:C70424 354>MOV WORD PTR SS:[ESP],4E35
00407A8C |. 8BCA MOV ECX,EDX
00407A8E |. 66:8B10 MOV DX,WORD PTR DS:[EAX]
00407A91 |. 66:8908 MOV WORD PTR DS:[EAX],CX
00407A94 |. 8BCA MOV ECX,EDX
00407A96 |. 8BD3 MOV EDX,EBX
00407A98 |. 8BD9 MOV EBX,ECX
00407A9A |. 66:0FAF1424 IMUL DX,WORD PTR SS:[ESP]
00407A9F |. 8BCA MOV ECX,EDX
00407AA1 |. 8BD6 MOV EDX,ESI
00407AA3 |. 8BF1 MOV ESI,ECX
00407AA5 |. 66:8B08 MOV CX,WORD PTR DS:[EAX]
00407AA8 |. 66:0FAFCA IMUL CX,DX
00407AAC |. 8BD1 MOV EDX,ECX
00407AAE |. 66:03F2 ADD SI,DX
00407AB1 |. 8BCA MOV ECX,EDX
00407AB3 |. 66:8B10 MOV DX,WORD PTR DS:[EAX]
00407AB6 |. 66:8908 MOV WORD PTR DS:[EAX],CX
00407AB9 |. 66:0FAF1424 IMUL DX,WORD PTR SS:[ESP]
00407ABE |. 66:03DE ADD BX,SI
00407AC1 |. 42 INC EDX
00407AC2 |. 66:8958 02 MOV WORD PTR DS:[EAX+2],BX
00407AC6 |. 0FB748 04 MOVZX ECX,WORD PTR DS:[EAX+4]
00407ACA |. 66:895448 06 MOV WORD PTR DS:[EAX+ECX*2+6],DX
00407ACF |. 66:FF40 04 INC WORD PTR DS:[EAX+4]
00407AD3 |. 8BC3 MOV EAX,EBX
00407AD5 |. 66:33C2 XOR AX,DX
00407AD8 |. 5A POP EDX
00407AD9 |. 5E POP ESI
00407ADA |. 5B POP EBX
00407ADB \. C3 RETN