-
-
[原创]看雪2016 第九题 CrackMe逆向分析
-
发表于: 2016-11-19 16:25 2623
-
OD打开crackme,查找所有参考字符串,发现 "Success!",双击来到
00403B6F |> \83BD 88FCFFFF>cmp dword ptr [ebp-378], 1
00403B76 |. 75 1D jnz short 00403B95
00403B78 |. 8BF4 mov esi, esp
00403B7A |. 6A 00 push 0 ; /Style = MB_OK|MB_APPLMODAL
00403B7C |. 68 34745B00 push 005B7434 ; |Title = "Congratulations"
00403B81 |. 68 28745B00 push 005B7428 ; |Text = "Success!"
00403B86 |. 6A 00 push 0 ; |hOwner = NULL
00403B88 |. FF15 2C2D5F00 call dword ptr [<&USER32.MessageBoxA>>; \MessageBoxA
00403B8E |. 3BF4 cmp esi, esp
00403B90 |. E8 1BBB0100 call 0041F6B0
00403B95 |> 5F pop edi
向上找到函数入口,下断
00403160 /> \55 push ebp
00403161 |. 8BEC mov ebp, esp
00403163 |. 81EC C0030000 sub esp, 3C0
00403169 |. 53 push ebx
0040316A |. 56 push esi
0040316B |. 57 push edi
0040316C |. 51 push ecx
0040316D |. 8DBD 40FCFFFF lea edi, dword ptr [ebp-3C0]
00403173 |. B9 F0000000 mov ecx, 0F0
00403178 |. B8 CCCCCCCC mov eax, CCCCCCCC
0040317D |. F3:AB rep stos dword ptr es:[edi]
0040317F |. 59 pop ecx
F9运行,输入序列号 11111111111111111111111111111111111,单步跟踪来到
00403198 |. 8945 F8 mov dword ptr [ebp-8], eax
0040319B |. C745 F4 00000>mov dword ptr [ebp-C], 0
004031A2 |. EB 09 jmp short 004031AD
004031A4 |> 8B45 F4 /mov eax, dword ptr [ebp-C]
004031A7 |. 83C0 01 |add eax, 1
004031AA |. 8945 F4 |mov dword ptr [ebp-C], eax
004031AD |> 8B4D F8 mov ecx, dword ptr [ebp-8]
004031B0 |. 034D F4 |add ecx, dword ptr [ebp-C]
004031B3 |. 0FBE11 |movsx edx, byte ptr [ecx]
004031B6 |. 85D2 |test edx, edx
004031B8 |. 74 02 |je short 004031BC
004031BA |.^ EB E8 \jmp short 004031A4
004031BC |> 837D F4 17 cmp dword ptr [ebp-C], 17 ; 23 个字符
004031C0 |. 74 05 je short 004031C7
004031C2 |. E9 CE090000 jmp 00403B95
发现字符个数为 23个字符
0040325C |> /8B45 F4 /mov eax, dword ptr [ebp-C]
0040325F |. |83C0 01 |add eax, 1
00403262 |. |8945 F4 |mov dword ptr [ebp-C], eax
00403265 |> |837D F4 05 cmp dword ptr [ebp-C], 5 ; 前5个字符是小写字母
00403269 |. |7D 1E |jge short 00403289
0040326B |. |8B8D 14FEFFFF |mov ecx, dword ptr [ebp-1EC]
00403271 |. |6BC9 1A |imul ecx, ecx, 1A
00403274 |. |8B55 F8 |mov edx, dword ptr [ebp-8]
00403277 |. |0355 F4 |add edx, dword ptr [ebp-C]
0040327A |. |0FBE02 |movsx eax, byte ptr [edx]
0040327D |. |8D4C01 9F |lea ecx, dword ptr [ecx+eax-61] ; -'a'
00403281 |. |898D 14FEFFFF |mov dword ptr [ebp-1EC], ecx
00403287 |.^\EB D3 \jmp short 0040325C
00403289 |> C785 10FEFFFF>mov dword ptr [ebp-1F0], 0F4240
每个字符需要 -‘a’,所以 重新输入序列号 aaaaaaaaaaaaaaaaaaaaaaa
y=
005B71CC 35 37 41 45 41 36 34 32 44 32 34 45 34 30 38 30 57AEA642D24E4080
005B71DC 42 32 33 31 37 37 42 46 43 43 34 30 38 31 34 45 B23177BFCC40814E
005B71EC 42 37 33 44 42 44 30 31 45 39 32 34 38 30 43 38 B73DBD01E92480C8
005B71FC 35 43 33 43 34 30 34 36 36 36 32 43 31 30 30 30 5C3C4046662C1000
005B720C 30 0
跟踪发现 x 大小为0时,通过。这个应该是个BUG。
sn = aaaaaaaaaaaaaaaaaaaaaaa
00403B6F |> \83BD 88FCFFFF>cmp dword ptr [ebp-378], 1
00403B76 |. 75 1D jnz short 00403B95
00403B78 |. 8BF4 mov esi, esp
00403B7A |. 6A 00 push 0 ; /Style = MB_OK|MB_APPLMODAL
00403B7C |. 68 34745B00 push 005B7434 ; |Title = "Congratulations"
00403B81 |. 68 28745B00 push 005B7428 ; |Text = "Success!"
00403B86 |. 6A 00 push 0 ; |hOwner = NULL
00403B88 |. FF15 2C2D5F00 call dword ptr [<&USER32.MessageBoxA>>; \MessageBoxA
00403B8E |. 3BF4 cmp esi, esp
00403B90 |. E8 1BBB0100 call 0041F6B0
00403B95 |> 5F pop edi
向上找到函数入口,下断
00403160 /> \55 push ebp
00403161 |. 8BEC mov ebp, esp
00403163 |. 81EC C0030000 sub esp, 3C0
00403169 |. 53 push ebx
0040316A |. 56 push esi
0040316B |. 57 push edi
0040316C |. 51 push ecx
0040316D |. 8DBD 40FCFFFF lea edi, dword ptr [ebp-3C0]
00403173 |. B9 F0000000 mov ecx, 0F0
00403178 |. B8 CCCCCCCC mov eax, CCCCCCCC
0040317D |. F3:AB rep stos dword ptr es:[edi]
0040317F |. 59 pop ecx
F9运行,输入序列号 11111111111111111111111111111111111,单步跟踪来到
00403198 |. 8945 F8 mov dword ptr [ebp-8], eax
0040319B |. C745 F4 00000>mov dword ptr [ebp-C], 0
004031A2 |. EB 09 jmp short 004031AD
004031A4 |> 8B45 F4 /mov eax, dword ptr [ebp-C]
004031A7 |. 83C0 01 |add eax, 1
004031AA |. 8945 F4 |mov dword ptr [ebp-C], eax
004031AD |> 8B4D F8 mov ecx, dword ptr [ebp-8]
004031B0 |. 034D F4 |add ecx, dword ptr [ebp-C]
004031B3 |. 0FBE11 |movsx edx, byte ptr [ecx]
004031B6 |. 85D2 |test edx, edx
004031B8 |. 74 02 |je short 004031BC
004031BA |.^ EB E8 \jmp short 004031A4
004031BC |> 837D F4 17 cmp dword ptr [ebp-C], 17 ; 23 个字符
004031C0 |. 74 05 je short 004031C7
004031C2 |. E9 CE090000 jmp 00403B95
发现字符个数为 23个字符
0040325C |> /8B45 F4 /mov eax, dword ptr [ebp-C]
0040325F |. |83C0 01 |add eax, 1
00403262 |. |8945 F4 |mov dword ptr [ebp-C], eax
00403265 |> |837D F4 05 cmp dword ptr [ebp-C], 5 ; 前5个字符是小写字母
00403269 |. |7D 1E |jge short 00403289
0040326B |. |8B8D 14FEFFFF |mov ecx, dword ptr [ebp-1EC]
00403271 |. |6BC9 1A |imul ecx, ecx, 1A
00403274 |. |8B55 F8 |mov edx, dword ptr [ebp-8]
00403277 |. |0355 F4 |add edx, dword ptr [ebp-C]
0040327A |. |0FBE02 |movsx eax, byte ptr [edx]
0040327D |. |8D4C01 9F |lea ecx, dword ptr [ecx+eax-61] ; -'a'
00403281 |. |898D 14FEFFFF |mov dword ptr [ebp-1EC], ecx
00403287 |.^\EB D3 \jmp short 0040325C
00403289 |> C785 10FEFFFF>mov dword ptr [ebp-1F0], 0F4240
每个字符需要 -‘a’,所以 重新输入序列号 aaaaaaaaaaaaaaaaaaaaaaa
y=
005B71CC 35 37 41 45 41 36 34 32 44 32 34 45 34 30 38 30 57AEA642D24E4080
005B71DC 42 32 33 31 37 37 42 46 43 43 34 30 38 31 34 45 B23177BFCC40814E
005B71EC 42 37 33 44 42 44 30 31 45 39 32 34 38 30 43 38 B73DBD01E92480C8
005B71FC 35 43 33 43 34 30 34 36 36 36 32 43 31 30 30 30 5C3C4046662C1000
005B720C 30 0
if ( k == l ) { for ( i = 0; *(&x + i); ++i ) { result = (char *)y[i]; if ( (char *)*(&x + i) != result ) { v13 = 0; break; } result = (char *)(i + 1); } } else { v13 = 0; } if ( v13 == 1 ) result = (char *)MessageBoxA(0, "Success!", "Congratulations", 0);
跟踪发现 x 大小为0时,通过。这个应该是个BUG。
sn = aaaaaaaaaaaaaaaaaaaaaaa
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
- [原创]C++类成员指针调用 4321
- [原创]VMP3.2授权分析 53966
- [原创]看雪CTF2017 第十二题分析 5080
- [原创]看雪CTF2017 第十一题分析 6218
- [原创]看雪CTF2017 第十题分析 5834
看原图
赞赏
雪币:
留言: