忽忽,看到帖子没动静了,我来凑凑热闹。
本人菜鸟啊,没能写出注册机,算法也跟了个乱七八糟,把过程整理上来,后面的兄弟跟上啊!^_^
提示:程序有壳,UPX 0.89.6 - 1.02 / 1.05 - 1.24 -> Markus & Laszlo [Overlay],随便搞下脱掉算了,我就不废话了,不会脱的找个脱壳机或者去脱壳版块搜索。
程序运行后alt+M在code段F2。运行程序输入名字和注册码。
004060CF E8 E0AD0000 call <jmp.&msvcrt.fgetc>
004060D4 83F8 FF cmp eax, -1<================然后会断在这里。
暂且不管一路跑下来,到这里:
00401408 8D85 D0FEFFFF lea eax, dword ptr [ebp-130]<=============用户名空间
0040140E 50 push eax
0040140F 68 A8604100 push 004160A8
00401414 E8 9F3C0000 call 004050B8 ; 取用户名
00401419 83C4 10 add esp, 10
0040141C 8B85 C4FEFFFF mov eax, dword ptr [ebp-13C]
00401422 8985 04FEFFFF mov dword ptr [ebp-1FC], eax
00401428 83C4 F4 add esp, -0C
后面通过分析知道这是取用户名的位置,下次分析可以直接在这附近F2。
继续往下来:
00401404 6A 0A push 0A
00401406 6A 0C push 0C
00401408 8D85 D0FEFFFF lea eax, dword ptr [ebp-130]
0040140E 50 push eax
0040140F 68 A8604100 push 004160A8
00401414 E8 9F3C0000 call 004050B8 ; 取用户名
00401419 83C4 10 add esp, 10
0040141C 8B85 C4FEFFFF mov eax, dword ptr [ebp-13C]
00401422 8985 04FEFFFF mov dword ptr [ebp-1FC], eax
00401428 83C4 F4 add esp, -0C
0040142B 8B85 C8FEFFFF mov eax, dword ptr [ebp-138] ; 取出用户名
00401431 50 push eax
00401432 E8 65030000 call 0040179C ; 取用户名长度
00401437 83C4 10 add esp, 10
0040143A 89C0 mov eax, eax
0040143C 8985 B8FEFFFF mov dword ptr [ebp-148], eax ; 保存用户名长度
00401442 83BD B8FEFFFF 0>cmp dword ptr [ebp-148], 2
00401449 /7F 29 jg short 00401474 ; 大于2才跳的哟,否则玩完了。。-_-!!
0040144B 8D53 04 lea edx, dword ptr [ebx+4]
0040144E 8B02 mov eax, dword ptr [edx]
00401450 83C0 04 add eax, 4
00401453 8B10 mov edx, dword ptr [eax]
00401455 8B0A mov ecx, dword ptr [edx]
00401457 8908 mov dword ptr [eax], ecx
00401459 83C4 F8 add esp, -8
0040145C 6A 02 push 2
0040145E 8D85 20FFFFFF lea eax, dword ptr [ebp-E0]
00401464 50 push eax
00401465 E8 C6000100 call 00411530
0040146A 83C4 10 add esp, 10
0040146D 31C0 xor eax, eax
0040146F E9 59010000 jmp 004015CD
00401474 8B85 08FEFFFF mov eax, dword ptr [ebp-1F8]
0040147A 8985 00FEFFFF mov dword ptr [ebp-200], eax
00401480 E8 F70B0000 call 0040207C ; 用户名计算
==============================================================================
来看看这段:用户名计算,小弟不才,未能写的更详细:
0040207C 55 push ebp
0040207D 89E5 mov ebp, esp
0040207F 81EC F0000000 sub esp, 0F0
00402085 57 push edi
00402086 56 push esi
00402087 83C4 F8 add esp, -8
0040208A 68 B04B4000 push 00404BB0
0040208F 68 28604100 push 00416028 ; ,`a
00402094 E8 E7220100 call 00414380
00402099 83C4 10 add esp, 10
0040209C 8DBD 60FFFFFF lea edi, dword ptr [ebp-A0]
004020A2 BE DC1F4000 mov esi, 00401FDC
004020A7 FC cld
004020A8 B9 28000000 mov ecx, 28
004020AD F3:A5 rep movs dword ptr es:[edi], dw>
004020AF C785 5CFFFFFF 0>mov dword ptr [ebp-A4], 0
004020B9 8DB426 00000000 lea esi, dword ptr [esi]
004020C0 83BD 5CFFFFFF 2>cmp dword ptr [ebp-A4], 27 ; 循环28次,0...28
004020C7 7E 07 jle short 004020D0
004020C9 EB 65 jmp short 00402130
004020CB 90 nop
004020CC 8D7426 00 lea esi, dword ptr [esi]
004020D0 8B85 5CFFFFFF mov eax, dword ptr [ebp-A4] ; 取当前循环次数
004020D6 89C2 mov edx, eax
004020D8 8D0495 00000000 lea eax, dword ptr [edx*4] ; eax *= 4
004020DF 8D95 60FFFFFF lea edx, dword ptr [ebp-A0] ; edx = keyBase
004020E5 8B0410 mov eax, dword ptr [eax+edx] ; 取DWORD, *(DWORD*)(KeyBase+eax)
004020E8 8985 58FFFFFF mov dword ptr [ebp-A8], eax ; 存 key
004020EE 8D85 20FFFFFF lea eax, dword ptr [ebp-E0] ; eax = Tbase
004020F4 8B95 5CFFFFFF mov edx, dword ptr [ebp-A4] ; 取循环次数
004020FA 8A8D 58FFFFFF mov cl, byte ptr [ebp-A8] ; cl = key
00402100 880C02 mov byte ptr [edx+eax], cl ; 保存cl
00402103 83C4 F8 add esp, -8
00402106 8D85 20FFFFFF lea eax, dword ptr [ebp-E0] ; 取 Tbase
0040210C 8B95 5CFFFFFF mov edx, dword ptr [ebp-A4] ; 再取位
00402112 0FBE0402 movsx eax, byte ptr [edx+eax] ; 取eax+位
00402116 50 push eax ; 传递 key
00402117 68 28604100 push 00416028 ; ,`a
0040211C E8 8B200000 call 004041AC
00402121 83C4 10 add esp, 10
00402124 FF85 5CFFFFFF inc dword ptr [ebp-A4]
0040212A ^ EB 94 jmp short 004020C0
0040212C 8D7426 00 lea esi, dword ptr [esi]
00402130 8DA5 08FFFFFF lea esp, dword ptr [ebp-F8]
00402136 5E pop esi
00402137 5F pop edi
00402138 C9 leave
00402139 C3 retn
==============================================================================
这里接上边用户名计算返回:
00401485 83C4 F4 add esp, -0C
00401488 68 A8604100 push 004160A8
0040148D E8 DA3E0100 call 0041536C
00401492 83C4 10 add esp, 10
00401495 6A 0A push 0A
00401497 6A 14 push 14
00401499 8D85 E0FEFFFF lea eax, dword ptr [ebp-120]
0040149F 50 push eax
004014A0 68 A8604100 push 004160A8
004014A5 E8 0E3C0000 call 004050B8 ; 取注册码
004014AA 83C4 10 add esp, 10
004014AD 83C4 F4 add esp, -0C
004014B0 8D85 E0FEFFFF lea eax, dword ptr [ebp-120] ; 取出注册码
004014B6 50 push eax
004014B7 E8 E0020000 call 0040179C ; 取注册码长度,下面没发现有长度检测,有兴趣你可以试试不输.^_^
004014BC 83C4 10 add esp, 10
004014BF 89C0 mov eax, eax
004014C1 8985 B4FEFFFF mov dword ptr [ebp-14C], eax ; 保存长度
004014C7 FF85 BCFEFFFF inc dword ptr [ebp-144]
004014CD C785 C0FEFFFF 0>mov dword ptr [ebp-140], 0
004014D7 83BD C0FEFFFF 2>cmp dword ptr [ebp-140], 27 ; 循环28次
004014DE 7E 02 jle short 004014E2
004014E0 EB 60 jmp short 00401542
004014E2 8B85 00FEFFFF mov eax, dword ptr [ebp-200] ; FFFFFFC9
004014E8 8985 30FEFFFF mov dword ptr [ebp-1D0], eax
004014EE 83C4 FC add esp, -4
004014F1 8B85 B8FEFFFF mov eax, dword ptr [ebp-148] ; 取用户名长度
004014F7 50 push eax
004014F8 8B85 C8FEFFFF mov eax, dword ptr [ebp-138] ; 取用户名
004014FE 50 push eax
004014FF 8B85 BCFEFFFF mov eax, dword ptr [ebp-144] ; 循环次数
00401505 50 push eax
00401506 E8 BD010000 call 004016C8 ; 这里全是浮点运算,晕死了。厉害的可以到里面看看,我就不带大家进去了-_-!!。
0040150B 83C4 10 add esp, 10
0040150E 89C0 mov eax, eax
00401510 8985 0CFEFFFF mov dword ptr [ebp-1F4], eax ; 结果保存
00401516 8B85 C0FEFFFF mov eax, dword ptr [ebp-140] ; 循环次数
0040151C 89C2 mov edx, eax
0040151E 8D0495 00000000 lea eax, dword ptr [edx*4] ; eax *= 4
00401525 8D95 10FEFFFF lea edx, dword ptr [ebp-1F0] ; edx = pBase
0040152B 8B8D 0CFEFFFF mov ecx, dword ptr [ebp-1F4] ; 取结果
00401531 890C10 mov dword ptr [eax+edx], ecx ; 保存到 pBase+eax
00401534 FF85 C0FEFFFF inc dword ptr [ebp-140] ; 循环次数+1
0040153A FF85 BCFEFFFF inc dword ptr [ebp-144] ; 循环次数+1
00401540 ^ EB 95 jmp short 004014D7
00401542 8B85 04FEFFFF mov eax, dword ptr [ebp-1FC]
00401548 8985 28FEFFFF mov dword ptr [ebp-1D8], eax
0040154E C785 FCFDFFFF 0>mov dword ptr [ebp-204], 0
00401558 83C4 F8 add esp, -8
0040155B 8B85 B4FEFFFF mov eax, dword ptr [ebp-14C] ; 注册码长度
00401561 50 push eax
00401562 8B85 CCFEFFFF mov eax, dword ptr [ebp-134] ; 取注册码
00401568 50 push eax
00401569 E8 F6000000 call 00401664 ; 返回值+=(注册码[i]ANSII码-len)
==============================================================================
路可一下 00401569 E8 F6000000 call 00401664 这个call,这是注册码第1次进行运算。
00401664 55 push ebp
00401665 89E5 mov ebp, esp
00401667 83EC 18 sub esp, 18
0040166A C745 FC 0000000>mov dword ptr [ebp-4], 0
00401671 C745 F8 0000000>mov dword ptr [ebp-8], 0
00401678 8B45 F8 mov eax, dword ptr [ebp-8]
0040167B 3B45 0C cmp eax, dword ptr [ebp+C] ; 比较是否循环完毕
0040167E 7C 02 jl short 00401682
00401680 EB 1E jmp short 004016A0
00401682 8B45 08 mov eax, dword ptr [ebp+8] ; 取注册码
00401685 8B55 F8 mov edx, dword ptr [ebp-8] ; 取循环次数,为了顺序取注册码每一位
00401688 01D0 add eax, edx ; 移动注册码指针
0040168A 0FBE10 movsx edx, byte ptr [eax] ; 取1位注册码
0040168D 0155 FC add dword ptr [ebp-4], edx ; 将注册码ANSII码累积
00401690 8B45 0C mov eax, dword ptr [ebp+C] ; 取长度
00401693 2945 FC sub dword ptr [ebp-4], eax ; 注册码-长度
00401696 FF45 F8 inc dword ptr [ebp-8] ; 循环次数增加
00401699 ^ EB DD jmp short 00401678
0040169B 90 nop
0040169C 8D7426 00 lea esi, dword ptr [esi]
004016A0 8B55 FC mov edx, dword ptr [ebp-4]
004016A3 89D0 mov eax, edx
004016A5 EB 00 jmp short 004016A7
004016A7 C9 leave
004016A8 C3 retn
==============================================================================
这里接上边返回:
0040156E 83C4 10 add esp, 10
00401571 89C0 mov eax, eax
00401573 8985 FCFDFFFF mov dword ptr [ebp-204], eax ; 保存返回值
00401579 83C4 F8 add esp, -8
0040157C 8B85 FCFDFFFF mov eax, dword ptr [ebp-204] ; 取返回值
00401582 50 push eax
00401583 8D85 10FEFFFF lea eax, dword ptr [ebp-1F0] ; push pBase,这里跟刚才浮点运算有关系。
00401589 50 push eax
0040158A E8 49000000 call 004015D8 ; 比较咯,经典呐!想爆破到里面找地方,不看真要后悔咯。。^_^
==============================================================================
来路可路可那句经典的东西在那里:(这里没有太详细的分析了,太累,以后有时间继续更新。)
004015D8 55 push ebp
004015D9 89E5 mov ebp, esp
004015DB 83EC 28 sub esp, 28
004015DE C745 F8 0000000>mov dword ptr [ebp-8], 0
004015E5 C745 F0 0000000>mov dword ptr [ebp-10], 0
004015EC C745 EC 0800000>mov dword ptr [ebp-14], 8
004015F3 8B45 08 mov eax, dword ptr [ebp+8]
004015F6 8945 E8 mov dword ptr [ebp-18], eax ; 保存 pBase
004015F9 C745 FC 0000000>mov dword ptr [ebp-4], 0
00401600 837D FC 09 cmp dword ptr [ebp-4], 9 ; 循环10次
00401604 7E 02 jle short 00401608
00401606 EB 1E jmp short 00401626
00401608 8B45 FC mov eax, dword ptr [ebp-4] ; 取当前循环次数
0040160B 8D1485 00000000 lea edx, dword ptr [eax*4] ; edx = eax * 4
00401612 8B45 08 mov eax, dword ptr [ebp+8] ; eax = pBase
00401615 8B1410 mov edx, dword ptr [eax+edx] ; edx = (pBase+edx)
00401618 8955 F4 mov dword ptr [ebp-C], edx ; 保存
0040161B 8B45 F4 mov eax, dword ptr [ebp-C]
0040161E 0145 F8 add dword ptr [ebp-8], eax
00401621 FF45 FC inc dword ptr [ebp-4] ; 循环次数++
00401624 ^ EB DA jmp short 00401600
00401626 8B45 0C mov eax, dword ptr [ebp+C]
00401629 89C2 mov edx, eax
0040162B C1E2 02 shl edx, 2
0040162E 01C2 add edx, eax
00401630 8D0CD5 00000000 lea ecx, dword ptr [edx*8]
00401637 89CA mov edx, ecx
00401639 29C2 sub edx, eax
0040163B 8955 0C mov dword ptr [ebp+C], edx
0040163E 8B45 F0 mov eax, dword ptr [ebp-10]
00401641 8B55 F8 mov edx, dword ptr [ebp-8]
00401644 01D0 add eax, edx
00401646 3B45 0C cmp eax, dword ptr [ebp+C]
00401649 75 07 jnz short 00401652 ; 哈哈!关键跳,想放松一下自己的朋友可以试试 90
0040164B E8 140B0000 call 00402164
00401650 EB 0F jmp short 00401661
00401652 83C4 F4 add esp, -0C
00401655 8B45 F0 mov eax, dword ptr [ebp-10]
00401658 50 push eax
00401659 E8 2E0C0000 call 0040228C
0040165E 83C4 10 add esp, 10
00401661 C9 leave
00401662 C3 retn
==============================================================================
接上边返回:
0040158F 83C4 10 add esp, 10
00401592 83C4 F8 add esp, -8
00401595 68 B04B4000 push 00404BB0
0040159A 68 28604100 push 00416028 ; ,`a
0040159F E8 DC2D0100 call 00414380
004015A4 83C4 10 add esp, 10
004015A7 8D53 04 lea edx, dword ptr [ebx+4]
004015AA 8B02 mov eax, dword ptr [edx]
004015AC 83C0 04 add eax, 4
004015AF 8B10 mov edx, dword ptr [eax]
004015B1 8B0A mov ecx, dword ptr [edx]
004015B3 8908 mov dword ptr [eax], ecx
004015B5 83C4 F8 add esp, -8
004015B8 6A 02 push 2
004015BA 8D85 20FFFFFF lea eax, dword ptr [ebp-E0]
004015C0 50 push eax
004015C1 E8 6AFF0000 call 00411530
004015C6 83C4 10 add esp, 10
004015C9 31C0 xor eax, eax
004015CB EB 00 jmp short 004015CD
004015CD 8DA5 C8FDFFFF lea esp, dword ptr [ebp-238]
004015D3 5B pop ebx
004015D4 5E pop esi
004015D5 5F pop edi
004015D6 C9 leave
004015D7 C3 retn
哎,实在是技术有限,这个CM对我来说太有难度了,也不知道分析的对不对,有错误大家指正一下,免得自己错了还误导了别人!
这个“甜点”目前看来是拿不下咯!!望梅止渴吧!!!
后面的兄弟们上呐!!