[原创][破]KeyGenMe.dihux.Win32ASM.1
发表于:
2006-11-19 15:46
5710
[原创][破]KeyGenMe.dihux.Win32ASM.1
【文章标题】: [破]KeyGenMe.dihux.Win32ASM.1
【文章作者】: HappyTown
【作者邮箱】: [email]wxr277@163.com[/email]
【作者主页】: www.pediy.com
【软件名称】: keygenme1
【下载地址】: 附件内
【加壳方式】: 无
【保护方式】: RSA-200
【使用工具】: OD,BigCalc,RSATool
【作者声明】: 只是感兴趣,没有其他目的。失误之处敬请诸位大侠赐教!
--------------------------------------------------------------------------------
【详细过程】
一、基本信息
1. PDiD察看得知,无壳,使用了BigLib库;
2. 用IDA载入biglib的.sig文件后生成map文件;
二、分析过程
1. OD载入程序,Loadmap刚才生成的map文件;
2. 下断点bpx GetDlgItemTextA;
3. 运行,输入试炼码:
name:happy
serial:7654321
00401065 |>push 19 ; /Count = 19 (25.)
00401067 |>push 00404330 ; |Buffer = dihux_ke.00404330
0040106C |>push 2711 ; |ControlID = 2711 (10001.)
00401071 |>push dword ptr [ebp+8] ; |hWnd
00401074 |>call <GetDlgItemTextA> ; \GetDlgItemTextA
00401079 |>cmp eax, 5 ; nameLen >= 5
0040107C |>jb 00401214
00401082 |>cmp eax, 14 ; <= 0x14
00401085 |>ja 00401214
0040108B |>mov [404429], eax
00401090 |>push 96 ; /Count = 96 (150.)
00401095 |>push 00404349 ; |Buffer = dihux_ke.00404349
0040109A |>push 2712 ; |ControlID = 2712 (10002.)
0040109F |>push dword ptr [ebp+8] ; |hWnd
004010A2 |>call <GetDlgItemTextA> ; \GetDlgItemTextA
004010A7 |>test al, al
004010A9 |>je 00401214
004010AF |>lea esi, [404349]
004010B5 |>/lods byte ptr [esi] ; Cases 30 ('0'),31 ('1'),32 ('2'),33 ('3'),34 ('4'),35 ('5'),36 ('6'),37 ('7'),38 ('8'),39 ('9'),41 ('A'),42 ('B'),43 ('C'),44 ('D'),45 ('E'),46 ('F') of switch 004010B6
004010B6 |>|test al, al ; Switch (cases 0..46)
004010B8 |>|je short 004010D8
004010BA |>|cmp al, 30
004010BC |>|jb 00401214
004010C2 |>|cmp al, 39
004010C4 |>|jbe short 004010B5
004010C6 |>|cmp al, 41
004010C8 |>|jb 00401214
004010CE |>|cmp al, 46
004010D0 |>|ja 00401214
004010D6 |>\jmp short 004010B5
004010D8 |>xor ecx, ecx ; Case 0 of switch 004010B6
004010DA |>/push 0
004010DC |>|call <__BigCreate@4>
004010E1 |>|mov [ecx*4+404411], eax
004010E8 |>|inc ecx
004010E9 |>|cmp ecx, 6
004010EC |>\jnz short 004010DA
004010EE |>push dword ptr [404411] ; /Arg3 = 00B60000
004010F4 |>push 10 ; |16进制
004010F6 |>push 0040401F ; |Arg1 = 0040401F ASCII "8ACFB4D27CBC8C2024A30C9417BBCA41AF3FC3BD9BDFF97F89"
004010FB |>call <__BigIn@12> ; \dihux_ke.004013F3
00401100 |>push dword ptr [404415] ; /Arg3 = 00C70000
00401106 |>push 10 ; |Arg2 = 00000010
00401108 |>push 00404019 ; |Arg1 = 00404019 ASCII "10001"
0040110D |>call <__BigIn@12> ; \dihux_ke.004013F3
00401112 |>push dword ptr [404425] ; /Arg3 = 00CB0000
00401118 |>push 10 ; |Arg2 = 00000010
0040111A |>push 00404349 ; |Arg1 = 00404349 ASCII "7654321"
0040111F |>call <__BigIn@12> ; \dihux_ke.004013F3
00401124 |>push 00404330 ; /String = "happy"
00401129 |>call <lstrlenA> ; \lstrlenA
0040112E |>push dword ptr [404419]
00401134 |>push eax
00401135 |>push 00404330 ; ASCII "happy"
0040113A |>call <__BigInB256@12>
0040113F |>push dword ptr [404421] ; c
00401145 |>push dword ptr [404411] ; n = 8ACFB4D27CBC8C2024A30C9417BBCA41AF3FC3BD9BDFF97F89
0040114B |>push dword ptr [404415] ; e = 10001
00401151 |>push dword ptr [404425] ; sn
00401157 |>call <__BigPowMod@16> ; c = sn^e (mod p)
0040115C |>mov eax, 1337
00401161 |>push 0 ; /Arg4 = 00000000
00401163 |>push dword ptr [40441D] ; |f
00401169 |>push eax ; |0x1337
0040116A |>push dword ptr [404421] ; |c
00401170 |>call <__BigDiv32@16> ; \f = c/1337
00401175 |>push dword ptr [40441D] ; f
0040117B |>push dword ptr [404419] ; name
00401181 |>call <__BigCompare@8>
00401186 |>jnz short 0040119C
00401188 |>push 0 ; /Style = MB_OK|MB_APPLMODAL
0040118A |>push 00404014 ; |Title = "iNFO"
0040118F |>push 00404004 ; |Text = "Serial is valid"
00401194 |>push dword ptr [ebp+8] ; |hOwner
00401197 |>call <MessageBoxA> ; \MessageBoxA
0040119C |>xor ecx, ecx
0040119E |>/push dword ptr [ecx*4+404411]
004011A5 |>|call <__BigDestroy@4>
004011AA |>|inc ecx
004011AB |>|cmp ecx, 6
004011AE |>\jnz short 0040119E
验证算法是:
(1) c = sn^e (mod n)
(2) f = c/0x1337
(3) f ?= name?
可以得知这个验证的核心是RSA。
用RSATool可求得:
n = 8ACFB4D27CBC8C2024A30C9417BBCA41AF3FC3BD9BDFF97F89
p = 970E1A438A10E069571BDCCBB
q = EB3FFE9F5C761995147C7A28B
d = 32593252229255151794D86C1A09C7AFCC2CCE42D440F55A2D
注册算法就是:
(1) f = name * 0x1337
(2) sn = f^d (mod n)
注册机就免了,一组可用的注册码:
name:happy
serial:230967525FD78420ED4B8C496BB80049497478BA3AA6588D80
--------------------------------------------------------------------------------
【经验总结】
这个KeyGenMe就是为了让大家理解RSA的过程,简单明了,还是推荐一下。
--------------------------------------------------------------------------------
【版权声明】: 本文原创于看雪技术论坛, 转载请注明作者并保持文章的完整, 谢谢!
2006年11月15日 23:29:40
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
上传的附件: