好友
阅读权限30
听众
最后登录1970-1-1
|
玖公子
发表于 2019-8-23 19:57
我别的工具都不会用,只会OD!
因此,看到这个程序,那就OD打开程序,停在这
[Asm] 纯文本查看 复制代码 00402510 . 56 push esi ; kernel32.Sleep
00402511 . 53 push ebx
00402512 . 83EC 14 sub esp,0x14
00402515 . 833D 18404000>cmp dword ptr ds:[0x404018],0x2
0040251C . 8B4424 24 mov eax,dword ptr ss:[esp+0x24]
00402520 . 74 0A je short crackme.0040252C
00402522 . C705 18404000>mov dword ptr ds:[0x404018],0x2
0040252C > 83F8 02 cmp eax,0x2
0040252F . 74 12 je short crackme.00402543
00402531 . 83F8 01 cmp eax,0x1
00402534 . 74 3A je short crackme.00402570
00402536 > 83C4 14 add esp,0x14
00402539 . B8 01000000 mov eax,0x1
0040253E . 5B pop ebx ; crackme.00401214
0040253F . 5E pop esi ; crackme.00401214
00402540 . C2 0C00 retn 0xC
我们F8单步到向下走,看到了
[Asm] 纯文本查看 复制代码 00401386 . E8 F20D0000 call crackme.0040217D
0040138B . 8B0D 08604000 mov ecx,dword ptr ds:[0x406008]
00401391 . A3 0C604000 mov dword ptr ds:[0x40600C],eax
00401396 . 85C9 test ecx,ecx ; msvcrt.77C04E29
00401398 . 0F84 CE000000 je crackme.0040146C
0040139E . 8B15 04604000 mov edx,dword ptr ds:[0x406004]
004013A4 . 85D2 test edx,edx
004013A6 . 75 0A jnz short crackme.004013B2
004013A8 . E8 0F1F0000 call <jmp.&msvcrt._cexit> ; [msvcrt._cexit
004013AD . A1 0C604000 mov eax,dword ptr ds:[0x40600C]
004013B2 > 8D65 F0 lea esp,dword ptr ss:[ebp-0x10]
004013B5 . 59 pop ecx ; msvcrt.77C04E29
004013B6 . 5B pop ebx
004013B7 . 5E pop esi
004013B8 . 5F pop edi
004013B9 . 5D pop ebp
004013BA . 8D61 FC lea esp,dword ptr ds:[ecx-0x4]
004013BD . C3 retn
下面是一个exit,百度一下,就是退出程序的意思!
00401386这里如果F8,程序就跑起来了,我们F7跟进去,继续F8单步走
[Asm] 纯文本查看 复制代码 00402201 |. E8 41FFFFFF call crackme.00402147
00402206 |. 8D8424 190100>lea eax,dword ptr ss:[esp+0x119]
0040220D |. 890424 mov dword ptr ss:[esp],eax
00402201在这里为我们回车进去能看到一个scanf函数,获取输入的数据
这里我们F8,程序跑飞,我们随便输入一个字符串:jiugongzi
程序此时还没跑飞,说明我们的思路是对的,我们继续F8向下走,来到了
[Asm] 纯文本查看 复制代码 00402298 |. E8 7BFBFFFF call crackme.00401E18
0040229D |> B8 00000000 mov eax,0x0
004022A2 |. 8D65 F8 lea esp,[local.2]
004022A5 |. 5B pop ebx
004022A6 |. 5F pop edi
004022A7 |. 5D pop ebp
004022A8 \. C3 retn
00402298这里如果我们F8,就会发现程序窗口已经出现错误信息(wrong flag!)了
因此,这个call我们要F7进去,看看它到底干了什么!
接着我们继续F8向下走,来到了
[Asm] 纯文本查看 复制代码 00401E5C |. E8 23FEFFFF call crackme.00401C84
00401E61 |. 8945 F4 mov [local.3],eax
00401E64 |> 8B45 F4 mov eax,[local.3] ; ||
00401E67 |. 890424 mov dword ptr ss:[esp],eax ; ||
00401E6A |. E8 F5130000 call <jmp.&msvcrt.puts> ; |\puts
00401E6F |. 8B45 F4 mov eax,[local.3] ; |
00401E72 |. 890424 mov dword ptr ss:[esp],eax ; |
00401E75 |. E8 0A140000 call <jmp.&msvcrt.free> ; \free
00401E7A |. 90 nop
00401E7B |. C9 leave
00401E7C \. C3 retn
我们发现下面那个retn就返回了,而返回后程序就直接输出错误信息了,puts这个函数是写入
字符串,free是释放内存。那么这个puts写入的内容肯定就是上面那个call里面干的!
所以00401E5C这个call我们F7进去
[Asm] 纯文本查看 复制代码 00401C84 /$ 55 push ebp
00401C85 |. 89E5 mov ebp,esp
00401C87 |. 53 push ebx
00401C88 |. 83EC 34 sub esp,0x34
00401C8B |. C745 DB 00000>mov dword ptr ss:[ebp-0x25],0x0 ; ||
00401C92 |. C745 DF 00000>mov dword ptr ss:[ebp-0x21],0x0 ; ||
00401C99 |. C645 E3 00 mov byte ptr ss:[ebp-0x1D],0x0 ; ||
00401C9D |. 8B45 0C mov eax,[arg.2] ; ||
00401CA0 |. 890424 mov dword ptr ss:[esp],eax ; ||
00401CA3 |. E8 CC150000 call <jmp.&msvcrt.malloc> ; |\malloc
00401CA8 |. 8945 E4 mov [local.7],eax ; |
00401CAB |. 8B45 0C mov eax,[arg.2] ; |
00401CAE |. 894424 08 mov dword ptr ss:[esp+0x8],eax ; |
00401CB2 |. 8B45 08 mov eax,[arg.1] ; |crackme.00405000
00401CB5 |. 894424 04 mov dword ptr ss:[esp+0x4],eax ; |
00401CB9 |. 8B45 E4 mov eax,[local.7] ; |
00401CBC |. 890424 mov dword ptr ss:[esp],eax ; |
00401CBF |. E8 A8150000 call <jmp.&msvcrt.memcpy> ; \memcpy
00401CC4 |. C745 F4 00000>mov [local.3],0x0
00401CCB |. EB 27 jmp short crackme.00401CF4
00401CCD |> A1 E0634000 /mov eax,dword ptr ds:[0x4063E0] ; 88?
00401CD2 |. 8B55 F4 |mov edx,[local.3]
00401CD5 |. 895424 04 |mov dword ptr ss:[esp+0x4],edx
00401CD9 |. 890424 |mov dword ptr ss:[esp],eax
00401CDC |. E8 7DF8FFFF |call crackme.0040155E
00401CE1 |. 8B00 |mov eax,dword ptr ds:[eax]
00401CE3 |. 8D50 61 |lea edx,dword ptr ds:[eax+0x61]
00401CE6 |. 8D4D DB |lea ecx,dword ptr ss:[ebp-0x25]
00401CE9 |. 8B45 F4 |mov eax,[local.3]
00401CEC |. 01C8 |add eax,ecx
00401CEE |. 8810 |mov byte ptr ds:[eax],dl
00401CF0 |. 8345 F4 01 |add [local.3],0x1
00401CF4 |> 837D F4 08 cmp [local.3],0x8
00401CF8 |.^ 7E D3 \jle short crackme.00401CCD
00401CFA |. 837D 10 00 cmp [arg.3],0x0
00401CFE |. 74 3B je short crackme.00401D3B
00401D00 |. C745 F0 00000>mov [local.4],0x0
00401D07 |. EB 28 jmp short crackme.00401D31
00401D09 |> 8B55 F0 /mov edx,[local.4]
00401D0C |. 8B45 E4 |mov eax,[local.7]
00401D0F |. 01D0 |add eax,edx
00401D11 |. 0FB618 |movzx ebx,byte ptr ds:[eax]
00401D14 |. 8D55 DB |lea edx,dword ptr ss:[ebp-0x25]
00401D17 |. 8B45 F0 |mov eax,[local.4]
00401D1A |. 01D0 |add eax,edx
00401D1C |. 0FB608 |movzx ecx,byte ptr ds:[eax]
00401D1F |. 8B55 F0 |mov edx,[local.4]
00401D22 |. 8B45 E4 |mov eax,[local.7]
00401D25 |. 01D0 |add eax,edx
00401D27 |. 31CB |xor ebx,ecx
00401D29 |. 89DA |mov edx,ebx
00401D2B |. 8810 |mov byte ptr ds:[eax],dl
00401D2D |. 8345 F0 01 |add [local.4],0x1
00401D31 |> 8B45 F0 mov eax,[local.4]
00401D34 |. 3B45 0C |cmp eax,[arg.2]
00401D37 |.^ 7C D0 \jl short crackme.00401D09
00401D39 |. EB 4C jmp short crackme.00401D87
00401D3B |> C745 EC 00000>mov [local.5],0x0
00401D42 |. EB 3B jmp short crackme.00401D7F
00401D44 |> C745 E8 00000>/mov [local.6],0x0
00401D4B |. EB 28 |jmp short crackme.00401D75
00401D4D |> 8B55 EC |/mov edx,[local.5]
00401D50 |. 8B45 E4 ||mov eax,[local.7]
00401D53 |. 01D0 ||add eax,edx
00401D55 |. 0FB618 ||movzx ebx,byte ptr ds:[eax]
00401D58 |. 8D55 DB ||lea edx,dword ptr ss:[ebp-0x25]
00401D5B |. 8B45 E8 ||mov eax,[local.6]
00401D5E |. 01D0 ||add eax,edx
00401D60 |. 0FB608 ||movzx ecx,byte ptr ds:[eax]
00401D63 |. 8B55 EC ||mov edx,[local.5]
00401D66 |. 8B45 E4 ||mov eax,[local.7]
00401D69 |. 01D0 ||add eax,edx
00401D6B |. 31CB ||xor ebx,ecx
00401D6D |. 89DA ||mov edx,ebx
00401D6F |. 8810 ||mov byte ptr ds:[eax],dl
00401D71 |. 8345 E8 01 ||add [local.6],0x1
00401D75 |> 837D E8 08 | cmp [local.6],0x8
00401D79 |.^ 7E D2 |\jle short crackme.00401D4D
00401D7B |. 8345 EC 01 |add [local.5],0x1
00401D7F |> 8B45 EC mov eax,[local.5]
00401D82 |. 3B45 0C |cmp eax,[arg.2]
00401D85 |.^ 7C BD \jl short crackme.00401D44
00401D87 |> 8B45 E4 mov eax,[local.7]
00401D8A |. 83C4 34 add esp,0x34
00401D8D |. 5B pop ebx ; 003F3838
00401D8E |. 5D pop ebp ; 003F3838
00401D8F \. C3 retn
这里面到底是干了啥能让程序输出错误信息(wrong flag!)
仔细观察堆栈窗口却只发现了
堆栈地址=0022FCA3, (ASCII "bfchediag 9?")
edx=00000000
猜测bfchediag这是正确的字符串?也不对啊!
实在是想不出来在哪做的比较!
只会用OD,强行装X分析一波,望各位看客不要见笑。(虽然啥也没分析出来) |
|