[反汇编练习] 160个CrackMe之028

[反汇编练习] 160个CrackMe之028.

本系列文章的目的是从一个没有任何经验的新手的角度(其实就是我自己),一步步尝试将160个CrackMe全部破解,如果可以,通过任何方式写出一个类似于注册机的东西。

其中,文章中按照如下逻辑编排(解决如下问题):

1、使用什么环境和工具

2、程序分析

3、思路分析和破解流程

4、注册机的探索

----------------------------------

提醒各位看客: 如果文章中的逻辑看不明白,那你一定是没有亲手操刀!OD中的跳转提示很强大,只要你跟踪了,不用怎么看代码就理解了!

----------------------------------

1、工具和环境:

WinXP SP3 + 52Pojie六周年纪念版OD + PEID + 汇编金手指。

160个CrackMe的打包文件。

下载地址: http://pan.baidu.com/s/1xUWOY 密码: jbnq

注:

1、Win7系统对于模块和程序开启了随机初始地址的功能,会给分析带来很大的负担,所以不建议使用Win7进行分析。

2、以上工具都是在52PoJie论坛下的原版程序,NOD32不报毒,个人承诺绝对不会进行任何和木马病毒相关内容。

wps_clip_image-880

2、程序分析:

想要破解一个程序,必须先了解这个程序。所以,在破解过程中,对最初程序的分析很重要,他可以帮助我们理解作者的目的和意图,特别是对于注册码的处理细节,从而方便我们反向跟踪和推导。

和上一节一样,打开CHM,选择第28个CoSH.2.exe,保存下来。运行程序,程序界面如下:

00

点击上面的Check按钮,弹出了信息框,很好。

注意的是,点击确定按钮后,程序直接退出了。

PEID:Microsoft Visual C++ 6.0

哈哈哈,VC++的,我最喜欢了!

 

3、思路分析和破解流程

没有信息框,我们可以试试查找文本的办法。

1、打开OD,将exe拖到OD窗口中,等程序暂停后,直接点击运行按钮(F9),不用理会。

2、随意输入伪码:BBDXF   123123。点击CHECK按钮,弹出信息框,不要关闭,回到OD。

3、Ctrl+K查看堆栈信息:

0

和之前的一样,找到Messagebox的下一个调用处,右键->Show call。

4、在反汇编窗口查看代码信息:

0040150C   .  E8 33030000   call <jmp.&MFC42.#3874>
00401511   .  8B07          mov eax,dword ptr ds:[edi]               
00401513   .  8038 36       cmp byte ptr ds:[eax],0x36
00401516   .  75 1E         jnz short 00401536
00401518   .  8078 01 32    cmp byte ptr ds:[eax+0x1],0x32
0040151C   .  75 18         jnz short 00401536
0040151E   .  8078 02 38    cmp byte ptr ds:[eax+0x2],0x38
00401522   .  75 12         jnz short 00401536
00401524   .  8078 03 37    cmp byte ptr ds:[eax+0x3],0x37
00401528   .  75 0C         jnz short 00401536
0040152A   .  8078 04 2D    cmp byte ptr ds:[eax+0x4],0x2D
0040152E   .  75 06         jnz short 00401536
00401530   .  8078 05 41    cmp byte ptr ds:[eax+0x5],0x41
00401534   .  74 17         je short 0040154D                        ;  // 很简单的跳转,关键跳
00401536   >  6A 00         push 0x0
00401538   .  68 64304000   push 00403064                            ;  ASCII "ERROR"
0040153D   .  68 38304000   push 00403038                            ;  ASCII "One of the Details you entered was wrong"
00401542   .  8BCE          mov ecx,esi
00401544   .  E8 F5020000   call <jmp.&MFC42.#4224>                  ;  // 返回到这里
00401549   .  6A 00         push 0x0
0040154B   .  FFD3          call ebx
0040154D   >  8D8E E0000000 lea ecx,dword ptr ds:[esi+0xE0]
00401553   .  8D5424 14     lea edx,dword ptr ss:[esp+0x14]
00401557   .  51            push ecx
00401558   .  68 2C304000   push 0040302C                            ;  ASCII "Well done,"
0040155D   .  52            push edx
0040155E   .  E8 D5020000   call <jmp.&MFC42.#926>
00401563   .  68 3C314000   push 0040313C
00401568   .  50            push eax
00401569   .  8D4424 18     lea eax,dword ptr ss:[esp+0x18]
0040156D   .  C74424 28 000>mov dword ptr ss:[esp+0x28],0x0
00401575   .  50            push eax
00401576   .  E8 B7020000   call <jmp.&MFC42.#924>
0040157B   .  8B00          mov eax,dword ptr ds:[eax]
0040157D   .  6A 00         push 0x0
0040157F   .  68 20304000   push 00403020                            ;  ASCII "YOU DID IT"
00401584   .  50            push eax
00401585   .  8BCE          mov ecx,esi
00401587   .  C64424 2C 01  mov byte ptr ss:[esp+0x2C],0x1
0040158C   .  E8 AD020000   call <jmp.&MFC42.#4224>

点击OK,程序就自动退出了。

爆破,修改je short 0040154D为jmp 0040154D。试一试,发现程序还是提示错误,内容为"One of the Details you entered was wrong"。看来,我们还有其他条件限制。

选中je跳转的下一句00401536   push 0x0,发现OD给提示还有其他地方的跳到这里,我们根据提示就发现004014E4  jle short 00401536,如果Name的长度小于5,则直接跳到错误。我们将这里也右键->Binary->Fill with NOPs.再试一试,呵呵,还是提示错误的!坑啊!

1

静下来想想,因为这里没有调往成功信息的地址,所以我们无论怎么修改都是在进行各种校验,只不过每次修改都是跳过了一个,但是我们已经知道了正确的地址,我们为何不再第一次校验的时候就直接跳到正确的位置呢?

修改jle short 00401536, 直接跳到正确的地址0040154D,即jmp 0040154D。试试:

2

哈哈,成功了!

 

4、注册机的探索

上面的代码其实已经分析好了:

004014B0   .  64:A1 0000000>mov eax,dword ptr fs:[0]
004014B6   .  6A FF         push -0x1
004014B8   .  68 701B4000   push 00401B70                            ;  溉%@
004014BD   .  50            push eax
004014BE   .  64:8925 00000>mov dword ptr fs:[0],esp
004014C5   .  83EC 08       sub esp,0x8
004014C8   .  53            push ebx
004014C9   .  55            push ebp
004014CA   .  56            push esi
004014CB   .  8BF1          mov esi,ecx
004014CD   .  57            push edi
004014CE   .  8DBE A0000000 lea edi,dword ptr ds:[esi+0xA0]
004014D4   .  8BCF          mov ecx,edi
004014D6   .  E8 6F030000   call <jmp.&MFC42.#3876>                  ;  // eax =5 , 猜测是计算Name的长度
004014DB   .  8B1D FC214000 mov ebx,dword ptr ds:[<&USER32.PostQuitM>;  user32.PostQuitMessage
004014E1   .  83F8 05       cmp eax,0x5
004014E4      7E 50         jle short 00401536                       ;  // 如果Name的长度小于5,则直接跳到错误
004014E6   .  8D6E 60       lea ebp,dword ptr ds:[esi+0x60]
004014E9   .  8BCD          mov ecx,ebp
004014EB   .  E8 5A030000   call <jmp.&MFC42.#3876>
004014F0   .  83F8 05       cmp eax,0x5
004014F3   .  7E 41         jle short 00401536
004014F5   .  8D86 E0000000 lea eax,dword ptr ds:[esi+0xE0]
004014FB   .  8BCF          mov ecx,edi
004014FD   .  50            push eax
004014FE   .  E8 41030000   call <jmp.&MFC42.#3874>
00401503   .  8DBE E4000000 lea edi,dword ptr ds:[esi+0xE4]
00401509   .  8BCD          mov ecx,ebp
0040150B   .  57            push edi
0040150C   .  E8 33030000   call <jmp.&MFC42.#3874>
00401511   .  8B07          mov eax,dword ptr ds:[edi]               ;  // 比较eax地址处的前6个字符,eax存放序列号地址
00401513   .  8038 36       cmp byte ptr ds:[eax],0x36               ;  //参看ansii表,得到 6287-A
00401516   .  75 1E         jnz short 00401536
00401518   .  8078 01 32    cmp byte ptr ds:[eax+0x1],0x32
0040151C   .  75 18         jnz short 00401536
0040151E   .  8078 02 38    cmp byte ptr ds:[eax+0x2],0x38
00401522   .  75 12         jnz short 00401536
00401524   .  8078 03 37    cmp byte ptr ds:[eax+0x3],0x37
00401528   .  75 0C         jnz short 00401536
0040152A   .  8078 04 2D    cmp byte ptr ds:[eax+0x4],0x2D
0040152E   .  75 06         jnz short 00401536
00401530   .  8078 05 41    cmp byte ptr ds:[eax+0x5],0x41
00401534      74 17         je short 0040154D                        ;  // 很简单的跳转,关键跳
00401536   >  6A 00         push 0x0
00401538   .  68 64304000   push 00403064                            ;  ERROR
0040153D   .  68 38304000   push 00403038                            ;  One of the Details you entered was wrong
00401542   .  8BCE          mov ecx,esi
00401544   .  E8 F5020000   call <jmp.&MFC42.#4224>                  ;  // 返回到这里
00401549   .  6A 00         push 0x0
0040154B   .  FFD3          call ebx
0040154D   >  8D8E E0000000 lea ecx,dword ptr ds:[esi+0xE0]
00401553   .  8D5424 14     lea edx,dword ptr ss:[esp+0x14]
00401557   .  51            push ecx
00401558   .  68 2C304000   push 0040302C                            ;  Well done,
0040155D   .  52            push edx
0040155E   .  E8 D5020000   call <jmp.&MFC42.#926>
00401563   .  68 3C314000   push 0040313C
00401568   .  50            push eax
00401569   .  8D4424 18     lea eax,dword ptr ss:[esp+0x18]
0040156D   .  C74424 28 000>mov dword ptr ss:[esp+0x28],0x0
00401575   .  50            push eax
00401576   .  E8 B7020000   call <jmp.&MFC42.#924>
0040157B   .  8B00          mov eax,dword ptr ds:[eax]
0040157D   .  6A 00         push 0x0
0040157F   .  68 20304000   push 00403020                            ;  YOU DID IT
00401584   .  50            push eax
00401585   .  8BCE          mov ecx,esi
00401587   .  C64424 2C 01  mov byte ptr ss:[esp+0x2C],0x1
0040158C   .  E8 AD020000   call <jmp.&MFC42.#4224>
00401591   .  8D4C24 10     lea ecx,dword ptr ss:[esp+0x10]
00401595   .  C64424 20 00  mov byte ptr ss:[esp+0x20],0x0
0040159A   .  E8 67010000   call <jmp.&MFC42.#800>
0040159F   .  8D4C24 14     lea ecx,dword ptr ss:[esp+0x14]
004015A3   .  C74424 20 FFF>mov dword ptr ss:[esp+0x20],-0x1
004015AB   .  E8 56010000   call <jmp.&MFC42.#800>
004015B0   .  6A 01         push 0x1
004015B2   .  FFD3          call ebx
004015B4   .  8B4C24 18     mov ecx,dword ptr ss:[esp+0x18]
004015B8   .  5F            pop edi
004015B9   .  5E            pop esi
004015BA   .  5D            pop ebp
004015BB   .  5B            pop ebx
004015BC   .  64:890D 00000>mov dword ptr fs:[0],ecx
004015C3   .  83C4 14       add esp,0x14
004015C6   .  C3            retn

在错误文本的上面几条汇编处,发现大量的cmp指令,进行了字符比较,我们在这里下断,输入Name长度大于5,然后发现eax存放的是字符串的初始地值,并逐个字符就进行比较。

重点在地址 00401513 处,连续对eax为起始地址的六个字节进行了比较校验,我们手动与ANSII表对比一下,他其实就是字符串“6287-A”。

好吧,这个整体校验就是先验证Name的长度必须大于5,然后Serial码必须是“6287-A”,我们再试试:

3

好了,Name长度大于5就可以,Serial是固定的: 【6287-A】。

 

BY  笨笨D幸福

posted @ 2014-07-05 14:14  笨笨D幸福  阅读(527)  评论(0编辑  收藏  举报
CSDN博客:http://blog.csdn.net/bbdxf CNBlogs: http://www.cnblogs.com/bbdxf