您的位置:首页 > 博客中心 > 数据库 >

OllyDbg 使用笔记 (三)

时间:2022-03-10 18:20

OllyDbg 使用笔记 (三)

参考

书:《加密与解密》

视频:小甲鱼 解密系列 视频


reverseME.exe 下载地址:http://pan.baidu.com/s/1c0fBgi8


0040105C . 6A 00 push 0 ; /hTemplateFile = NULL 0040105E . 68 6F214000 push 0040216F ; |Attributes = READONLY|HIDDEN|SYSTEM|ARCHIVE|TEMPORARY|402048 00401063 . 6A 03 push 3 ; |Mode = OPEN_EXISTING 00401065 . 6A 00 push 0 ; |pSecurity = NULL 00401067 . 6A 03 push 3 ; |ShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE 00401069 . 68 000000C0 push C0000000 ; |Access = GENERIC_READ|GENERIC_WRITE 0040106E . 68 79204000 push 00402079 ; |FileName = "Keyfile.dat" 00401073 . E8 0B020000 call <jmp.&KERNEL32.CreateFileA> ; \CreateFileA 00401078 . 83F8 FF cmp eax, -1 0040107B 75 1D jnz short 0040109A 0040107D . 6A 00 push 0 ; |/Style = MB_OK|MB_APPLMODAL 0040107F . 68 00204000 push 00402000 ; ||Title = " Key File ReverseMe" 00401084 . 68 17204000 push 00402017 ; ||Text = "Evaluation period out of date. Purchase new license" 00401089 . 6A 00 push 0 ; ||hOwner = NULL 0040108B . E8 D7020000 call <jmp.&USER32.MessageBoxA> ; |\MessageBoxA 00401090 . E8 24020000 call <jmp.&KERNEL32.ExitProcess> ; \ExitProcess 00401095 . E9 83010000 jmp 0040121D 0040109A > 6A 00 push 0 ; /pOverlapped = NULL 0040109C . 68 73214000 push 00402173 ; |pBytesRead = reverseM.00402173 004010A1 . 6A 46 push 46 ; |BytesToRead = 46 (70.) 004010A3 . 68 1A214000 push 0040211A ; |Buffer = reverseM.0040211A 004010A8 . 50 push eax ; |hFile 004010A9 . E8 2F020000 call <jmp.&KERNEL32.ReadFile> ; \ReadFile 004010AE . 85C0 test eax, eax 004010B0 . 75 02 jnz short 004010B4 004010B2 . EB 43 jmp short 004010F7 004010B4 > 33DB xor ebx, ebx 004010B6 . 33F6 xor esi, esi 004010B8 . 833D 73214000>cmp dword ptr [402173], 10 004010BF . 7C 36 jl short 004010F7 004010C1 > 8A83 1A214000 mov al, byte ptr [ebx+40211A] 004010C7 . 3C 00 cmp al, 0 004010C9 . 74 08 je short 004010D3 004010CB . 3C 47 cmp al, 47 004010CD . 75 01 jnz short 004010D0 004010CF . 46 inc esi 004010D0 > 43 inc ebx 004010D1 .^ EB EE jmp short 004010C1 004010D3 > 83FE 08 cmp esi, 8 004010D6 . 7C 1F jl short 004010F7 004010D8 . E9 28010000 jmp 00401205

004010F5   . /EB 00         jmp     short 004010F7
004010F7   > \6A 00         push    0                                ; |/Style = MB_OK|MB_APPLMODAL
004010F9   .  68 00204000   push    00402000                         ; ||Title = " Key File ReverseMe"
004010FE   .  68 86204000   push    00402086                         ; ||Text = "Keyfile is not valid. Sorry."
00401103   .  6A 00         push    0                                ; ||hOwner = NULL
00401105   .  E8 5D020000   call    <jmp.&USER32.MessageBoxA>        ; |\MessageBoxA
0040110A   .  E8 AA010000   call    <jmp.&KERNEL32.ExitProcess>      ; \ExitProcess
0040110F   .  E9 09010000   jmp     0040121D

00401205   > \6A 00         push    0                                ; |/Style = MB_OK|MB_APPLMODAL
00401207   .  68 00204000   push    00402000                         ; ||Title = " Key File ReverseMe"
0040120C   .  68 DE204000   push    004020DE                         ; ||Text = "You really did it! Congratz !!!"
00401211   .  6A 00         push    0                                ; ||hOwner = NULL
00401213   .  E8 4F010000   call    <jmp.&USER32.MessageBoxA>        ; |\MessageBoxA
00401218   .  E8 9C000000   call    <jmp.&KERNEL32.ExitProcess>      ; \ExitProcess
0040121D   >  C3            retn



我们可以由 0040106E 得出 密钥文件是Keyfile.dat

如果没有发现Keyfile.dat ,函数返回eax=-1,0040107b 的 jnz 就不会跳转,接着执行。

如果Keyfile.dat存在,就会跳转到0040109A处。

0040109A~004010A9 是读取文件函数不用管,如果读取出错就会跳到004010F7。

004010B2~004010D8 就是计算Keyfile.dat对不对。

我们可以知道,最终目的是为了要程序跳转到00401205处,可以发现,就是要使004010D8 运行

运行尝试修改004010B2~004010D8 中的跳转,时jmp  00401205 运行。


暴力破解


通过上面的分析,

我们先把0040107B 的   jnz     short 0040109A改成 jmp     short004010D8即可。


分析密钥


看004010B4~004010D8的代码

先比较密钥长度是不是大于10,如果大于10接着运行。

发现004010C1~004010D1这是一个循环,在一个一个的比较密钥文件的字符是不是 ASCII 47,用esi记录循环的次数直到读取到ASCII 0 为止。

循环结束,判断esi是否大于8,大于则jmp 00401205。


所以我们新建Keyfile.dat,用记事本写如 GGGGGGGGGGGGGGGG0 即可。
















OllyDbg 使用笔记 (三),布布扣,bubuko.com

热门排行

今日推荐

热门手游