强大反调试cm的奇葩破解

时间:2022-06-10 04:57:40

系统 : Windows xp

程序 : Crackme-xp

程序下载地址 :http://pan.baidu.com/s/1slUwmVr

要求 : 编写注册机

使用工具 : OD & IDA

可在看雪论坛中查找关于此程序的破文:传送门

这是一个拥有强大反调试机制的cm,无法查询到关键子串、下获取窗口文本的断点没用,设置对按钮下消息断点都没用。

然后用IDA打开后却发现了函数表里有:

强大反调试cm的奇葩破解

强大反调试cm的奇葩破解

。。。。。。。。。。。。。。。。。。

这个懂点英文的人都能看出来是 注册按钮的处理函数吧?所以前面那么多防护机制是为了什么?

强大反调试cm的奇葩破解

直接定位关键代码:

  /.              push    ebp                              ;  btn_click
|. 8BEC mov ebp, esp
|. 81C4 70FFFFFF add esp, -
0040144D |. 78FFFFFF mov dword ptr [ebp-], edx
|. 7CFFFFFF mov dword ptr [ebp-], eax
|. B8 mov eax,
0040145E |. E8 71CC0200 call 0042E0D4
|. :C745 >mov word ptr [ebp-],
|. 8D45 FC lea eax, dword ptr [ebp-]
0040146C |. E8 call 004019F8
|. FF45 9C inc dword ptr [ebp-]
|. :C745 >mov word ptr [ebp-],
0040147A |. :C745 >mov word ptr [ebp-],
|. 8D45 F8 lea eax, dword ptr [ebp-]
|. E8 call 004019F8
|. FF45 9C inc dword ptr [ebp-]
0040148B |. :C745 >mov word ptr [ebp-],
|. :C745 2C>mov word ptr [ebp-], 2C
|. 8D45 F4 lea eax, dword ptr [ebp-C]
0040149A |. E8 call 004019F8
0040149F |. FF45 9C inc dword ptr [ebp-]
004014A2 |. :C745 >mov word ptr [ebp-],
004014A8 |. :C745 >mov word ptr [ebp-],
004014AE |. 8D45 F0 lea eax, dword ptr [ebp-]
004014B1 |. E8 call 004019F8
004014B6 |. FF45 9C inc dword ptr [ebp-]
004014B9 |. :C745 >mov word ptr [ebp-],
004014BF |. :C745 >mov word ptr [ebp-],
004014C5 |. 8D45 EC lea eax, dword ptr [ebp-]
004014C8 |. E8 2B050000 call 004019F8
004014CD |. FF45 9C inc dword ptr [ebp-]
004014D0 |. :C745 >mov word ptr [ebp-],
004014D6 |. :C745 >mov word ptr [ebp-],
004014DC |. 8D45 E8 lea eax, dword ptr [ebp-]
004014DF |. E8 call 004019F8
004014E4 |. FF45 9C inc dword ptr [ebp-]
004014E7 |. :C745 >mov word ptr [ebp-],
004014ED |. :C745 5C>mov word ptr [ebp-], 5C
004014F3 |. 8D45 E4 lea eax, dword ptr [ebp-1C]
004014F6 |. E8 FD040000 call 004019F8
004014FB |. 8BD0 mov edx, eax
004014FD |. FF45 9C inc dword ptr [ebp-]
|. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
|. 8B81 F0010000 mov eax, dword ptr [ecx+1F0]
0040150C |. E8 8B940000 call 0040A99C
|. 8D55 E4 lea edx, dword ptr [ebp-1C]
|. 8D45 EC lea eax, dword ptr [ebp-]
|. E8 0BE20000 call 0040F727
0040151C |. FF4D 9C dec dword ptr [ebp-]
0040151F |. 8D45 E4 lea eax, dword ptr [ebp-1C]
|. BA mov edx,
|. E8 CCE10000 call 0040F6F8
0040152C |. :C745 >mov word ptr [ebp-],
|. 8D45 E0 lea eax, dword ptr [ebp-]
|. E8 BE040000 call 004019F8
0040153A |. 8BD0 mov edx, eax
0040153C |. FF45 9C inc dword ptr [ebp-]
0040153F |. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
|. 8B81 F4010000 mov eax, dword ptr [ecx+1F4]
0040154B |. E8 4C940000 call 0040A99C
|. 8D55 E0 lea edx, dword ptr [ebp-]
|. 8D45 E8 lea eax, dword ptr [ebp-]
|. E8 CCE10000 call 0040F727
0040155B |. FF4D 9C dec dword ptr [ebp-]
0040155E |. 8D45 E0 lea eax, dword ptr [ebp-]
|. BA mov edx,
|. E8 8DE10000 call 0040F6F8
0040156B |. :C745 >mov word ptr [ebp-],
|. 8D45 DC lea eax, dword ptr [ebp-]
|. E8 7F040000 call 004019F8
|. 8BD0 mov edx, eax
0040157B |. FF45 9C inc dword ptr [ebp-]
0040157E |. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
|. 8B81 D0010000 mov eax, dword ptr [ecx+1D0]
0040158A |. E8 0D940000 call 0040A99C
0040158F |. 8D55 DC lea edx, dword ptr [ebp-]
|. 8D45 FC lea eax, dword ptr [ebp-]
|. E8 8DE10000 call 0040F727
0040159A |. FF4D 9C dec dword ptr [ebp-]
0040159D |. 8D45 DC lea eax, dword ptr [ebp-]
004015A0 |. BA mov edx,
004015A5 |. E8 4EE10000 call 0040F6F8
004015AA |. :C745 >mov word ptr [ebp-],
004015B0 |. 8D45 D8 lea eax, dword ptr [ebp-]
004015B3 |. E8 call 004019F8
004015B8 |. 8BD0 mov edx, eax
004015BA |. FF45 9C inc dword ptr [ebp-]
004015BD |. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
004015C3 |. 8B81 D4010000 mov eax, dword ptr [ecx+1D4]
004015C9 |. E8 CE930000 call 0040A99C
004015CE |. 8D55 D8 lea edx, dword ptr [ebp-]
004015D1 |. 8D45 F8 lea eax, dword ptr [ebp-]
004015D4 |. E8 4EE10000 call 0040F727
004015D9 |. FF4D 9C dec dword ptr [ebp-]
004015DC |. 8D45 D8 lea eax, dword ptr [ebp-]
004015DF |. BA mov edx,
004015E4 |. E8 0FE10000 call 0040F6F8
004015E9 |. :C745 8C>mov word ptr [ebp-], 8C
004015EF |. 8D45 D4 lea eax, dword ptr [ebp-2C]
004015F2 |. E8 call 004019F8
004015F7 |. push eax
004015F8 |. FF45 9C inc dword ptr [ebp-]
004015FB |. 8D45 F8 lea eax, dword ptr [ebp-]
004015FE |. B9 mov ecx,
|. 33D2 xor edx, edx
|. E8 69EB0000 call
0040160A |. 8D45 D4 lea eax, dword ptr [ebp-2C] ; (initial cpu selection)
0040160D |. 8D55 EC lea edx, dword ptr [ebp-]
|. E8 C3E10000 call 0040F7D8 ; 判断call
|. push eax ; 压入函数结果
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 D4 lea eax, dword ptr [ebp-2C]
0040161C |. BA mov edx,
|. E8 D2E00000 call 0040F6F8
|. pop ecx
|. 84C9 test cl, cl ; 测试的是栈顶元素,所以压入元素的函数就是判断函数
|. 0F84 je
0040162F |. :C745 >mov word ptr [ebp-],
|. 8D45 D0 lea eax, dword ptr [ebp-]
|. E8 BB030000 call 004019F8
0040163D |. push eax
0040163E |. FF45 9C inc dword ptr [ebp-]
|. 8D45 F8 lea eax, dword ptr [ebp-]
|. E8 09E30000 call 0040F952
|. 8BD0 mov edx, eax
0040164B |. 83C2 FC add edx, -
0040164E |. 8D45 F8 lea eax, dword ptr [ebp-]
|. B9 mov ecx,
|. E8 18EB0000 call
0040165B |. 8D45 D0 lea eax, dword ptr [ebp-]
0040165E |. 8D55 E8 lea edx, dword ptr [ebp-]
|. E8 72E10000 call 0040F7D8 ; 判断call
|. push eax ; 压入函数结果
|. FF4D 9C dec dword ptr [ebp-]
0040166A |. 8D45 D0 lea eax, dword ptr [ebp-]
0040166D |. BA mov edx,
|. E8 81E00000 call 0040F6F8
|. pop ecx
|. 84C9 test cl, cl
0040167A |. 0F84 D5020000 je
|. 33C0 xor eax, eax
|. 74FFFFFF mov dword ptr [ebp-8C], eax
|. :C745 >mov word ptr [ebp-],
0040168E |. 33D2 xor edx, edx
|. 70FFFFFF mov dword ptr [ebp-], edx
|. EB 1E jmp short 004016B6
|> 8D45 FC /lea eax, dword ptr [ebp-]
0040169B |. E8 |call 00401A28
004016A0 |. 8B95 70FFFFFF |mov edx, dword ptr [ebp-]
004016A6 |. 0FBE0C10 |movsx ecx, byte ptr [eax+edx] ; 迭代用户名字符串
004016AA |. 018D 74FFFFFF |add dword ptr [ebp-8C], ecx ; 累加
004016B0 |. FF85 70FFFFFF |inc dword ptr [ebp-] ; 循环变量自增
004016B6 |> 8D45 FC lea eax, dword ptr [ebp-]
004016B9 |. E8 94E20000 |call 0040F952 ; 获取长度
004016BE |. 3B85 70FFFFFF |cmp eax, dword ptr [ebp-] ; 遍历完毕?
004016C4 |.^ 7F D2 \jg short
004016C6 |. 8B95 74FFFFFF mov edx, dword ptr [ebp-8C] ; 获取累加结果
004016CC |. 0FAF95 74FFFF>imul edx, dword ptr [ebp-8C]
004016D3 |. 81C2 AC000000 add edx, 0AC
004016D9 |. 74FFFFFF mov dword ptr [ebp-8C], edx ; 保存结果
004016DF |. :C745 A4>mov word ptr [ebp-], 0A4
004016E5 |. 8D45 CC lea eax, dword ptr [ebp-]
004016E8 |. 8B95 74FFFFFF mov edx, dword ptr [ebp-8C]
004016EE |. E8 32DF0000 call 0040F625
004016F3 |. FF45 9C inc dword ptr [ebp-]
004016F6 |. 8D55 CC lea edx, dword ptr [ebp-]
004016F9 |. 8D45 F4 lea eax, dword ptr [ebp-C]
004016FC |. E8 26E00000 call 0040F727
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 CC lea eax, dword ptr [ebp-]
|. BA mov edx,
0040170C |. E8 E7DF0000 call 0040F6F8
|. :C745 B0>mov word ptr [ebp-], 0B0
|. 8D45 C8 lea eax, dword ptr [ebp-]
0040171A |. E8 D9020000 call 004019F8
0040171F |. 8BC8 mov ecx, eax
|. FF45 9C inc dword ptr [ebp-]
|. 8D55 F4 lea edx, dword ptr [ebp-C]
|. 8D45 EC lea eax, dword ptr [ebp-]
0040172A |. E8 20E00000 call 0040F74F
0040172F |. 8D55 C8 lea edx, dword ptr [ebp-]
|. push edx
|. 8D45 C4 lea eax, dword ptr [ebp-3C]
|. E8 BD020000 call 004019F8
0040173B |. 8BC8 mov ecx, eax
0040173D |. FF45 9C inc dword ptr [ebp-]
|. 8D55 E8 lea edx, dword ptr [ebp-]
|. pop eax
|. E8 06E00000 call 0040F74F
|. 8D55 C4 lea edx, dword ptr [ebp-3C]
0040174C |. 8D45 F0 lea eax, dword ptr [ebp-]
0040174F |. E8 D3DF0000 call 0040F727
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 C4 lea eax, dword ptr [ebp-3C]
0040175A |. BA mov edx,
0040175F |. E8 94DF0000 call 0040F6F8
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 C8 lea eax, dword ptr [ebp-]
0040176A |. BA mov edx,
0040176F |. E8 84DF0000 call 0040F6F8
|. 8D55 F0 lea edx, dword ptr [ebp-]
|. 8D45 F8 lea eax, dword ptr [ebp-]
0040177A |. E8 59E00000 call 0040F7D8 ; 判断call
0040177F |. 84C0 test al, al
|. 0F84 CE010000 je
|. :C745 BC>mov word ptr [ebp-], 0BC
0040178D |. 8D45 C0 lea eax, dword ptr [ebp-]
|. E8 call 004019F8
|. FF45 9C inc dword ptr [ebp-]
|. :C745 C8>mov word ptr [ebp-], 0C8
0040179E |. :C745 D4>mov word ptr [ebp-], 0D4
004017A4 |. 8D45 BC lea eax, dword ptr [ebp-]
004017A7 |. E8 4C020000 call 004019F8
004017AC |. FF45 9C inc dword ptr [ebp-]
004017AF |. :C745 C8>mov word ptr [ebp-], 0C8
004017B5 |. :C745 E0>mov word ptr [ebp-], 0E0
004017BB |. 8D45 B8 lea eax, dword ptr [ebp-]
004017BE |. E8 call 004019F8
004017C3 |. FF45 9C inc dword ptr [ebp-]
004017C6 |. :C745 C8>mov word ptr [ebp-], 0C8
004017CC |. :C745 EC>mov word ptr [ebp-], 0EC
004017D2 |. 8D45 B4 lea eax, dword ptr [ebp-4C]
004017D5 |. E8 1E020000 call 004019F8
004017DA |. FF45 9C inc dword ptr [ebp-]
004017DD |. :C745 C8>mov word ptr [ebp-], 0C8
004017E3 |. :C745 F8>mov word ptr [ebp-], 0F8
004017E9 |. 8D45 B0 lea eax, dword ptr [ebp-]
004017EC |. E8 call 004019F8
004017F1 |. 8BD0 mov edx, eax
004017F3 |. FF45 9C inc dword ptr [ebp-]
004017F6 |. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
004017FC |. 8B81 E0010000 mov eax, dword ptr [ecx+1E0]
|. E8 call 0040A99C
|. 8D55 B0 lea edx, dword ptr [ebp-]
0040180A |. 8D45 C0 lea eax, dword ptr [ebp-]
0040180D |. E8 15DF0000 call 0040F727
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 B0 lea eax, dword ptr [ebp-]
|. BA mov edx,
0040181D |. E8 D6DE0000 call 0040F6F8
|. :C745 >mov word ptr [ebp-],
|. 8D45 AC lea eax, dword ptr [ebp-]
0040182B |. E8 C8010000 call 004019F8
|. 8BD0 mov edx, eax
|. FF45 9C inc dword ptr [ebp-]
|. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
0040183B |. 8B81 E4010000 mov eax, dword ptr [ecx+1E4]
|. E8 call 0040A99C
|. 8D55 AC lea edx, dword ptr [ebp-]
|. 8D45 BC lea eax, dword ptr [ebp-]
0040184C |. E8 D6DE0000 call 0040F727
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 AC lea eax, dword ptr [ebp-]
|. BA mov edx,
0040185C |. E8 97DE0000 call 0040F6F8
|. :C745 >mov word ptr [ebp-],
|. 8D45 A8 lea eax, dword ptr [ebp-]
0040186A |. E8 call 004019F8
0040186F |. 8BD0 mov edx, eax
|. FF45 9C inc dword ptr [ebp-]
|. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
0040187A |. 8B81 E8010000 mov eax, dword ptr [ecx+1E8]
|. E8 call 0040A99C
|. 8D55 A8 lea edx, dword ptr [ebp-]
|. 8D45 B8 lea eax, dword ptr [ebp-]
0040188B |. E8 97DE0000 call 0040F727
|. FF4D 9C dec dword ptr [ebp-]
|. 8D45 A8 lea eax, dword ptr [ebp-]
|. BA mov edx,
0040189B |. E8 58DE0000 call 0040F6F8
004018A0 |. :C745 1C>mov word ptr [ebp-], 11C
004018A6 |. 8D45 A4 lea eax, dword ptr [ebp-5C]
004018A9 |. E8 4A010000 call 004019F8
004018AE |. 8BD0 mov edx, eax
004018B0 |. FF45 9C inc dword ptr [ebp-]
004018B3 |. 8B0D E0AE4300 mov ecx, dword ptr [43AEE0]
004018B9 |. 8B81 EC010000 mov eax, dword ptr [ecx+1EC]
004018BF |. E8 D8900000 call 0040A99C
004018C4 |. 8D55 A4 lea edx, dword ptr [ebp-5C]
004018C7 |. 8D45 B4 lea eax, dword ptr [ebp-4C]
004018CA |. E8 58DE0000 call 0040F727
004018CF |. FF4D 9C dec dword ptr [ebp-]
004018D2 |. 8D45 A4 lea eax, dword ptr [ebp-5C]
004018D5 |. BA mov edx,
004018DA |. E8 19DE0000 call 0040F6F8
004018DF |. 6A push
004018E1 |. 8D45 BC lea eax, dword ptr [ebp-]
004018E4 |. E8 3F010000 call 00401A28
004018E9 |. push eax
004018EA |. 8D45 C0 lea eax, dword ptr [ebp-]
004018ED |. E8 call 00401A28
004018F2 |. push eax ; |Text
004018F3 |. 6A push ; |hOwner = NULL
004018F5 |. E8 A63A0300 call <jmp.&USER32.MessageBoxA> ; \MessageBoxA
004018FA |. 6A push
004018FC |. 8D45 B4 lea eax, dword ptr [ebp-4C]
004018FF |. E8 call 00401A28
|. push eax
|. 8D45 B8 lea eax, dword ptr [ebp-]
|. E8 1B010000 call 00401A28
0040190D |. push eax ; |Text
0040190E |. 6A push ; |hOwner = NULL
|. E8 8B3A0300 call <jmp.&USER32.MessageBoxA> ; \MessageBoxA

其中判断call的代码:

0040F7D8  /$              push    ebp
0040F7D9 |. 8BEC mov ebp, esp
0040F7DB |. push ebx
0040F7DC |. 8B00 mov eax, dword ptr [eax]
0040F7DE |. 8B12 mov edx, dword ptr [edx]
0040F7E0 |. E8 B7640100 call 00425C9C ; 两个字符串是否相同?
0040F7E5 |. 0F94C0 sete al
0040F7E8 |. 83E0 and eax,
0040F7EB |. 5B pop ebx
0040F7EC |. 5D pop ebp
0040F7ED \. C3 retn

就是一个很简单的加密,直接打开http://www.cnblogs.com/ZRBYYXDM/p/5115596.html中搭建的框架,修改OnBtnDecrypt函数如下:

void CKengen_TemplateDlg::OnBtnDecrypt()
{
// TODO: Add your control notification handler code here
CString str;
GetDlgItemText( IDC_EDIT_NAME,str ); //获取用户名字串基本信息。
int len = str.GetLength(); DWORD Res = ;
if ( len != ){ //格式控制。
unsigned sum = ;
for ( int i = ; i != len ; i++ )
sum += str[i]; CString PassWord;
PassWord.Format( "CA-%d-3914",sum * sum + 0xAC );
SetDlgItemText( IDC_EDIT_PASSWORD,PassWord );
}
else
MessageBox( "用户名格式错误!" );
}

再在OnInitDialog中添加此代码修改标题:SetWindowText(_T("Keygen"));

运行效果:

强大反调试cm的奇葩破解