Crackme 名称 :KeygenMe #1 By Kostya
Cracker :ainafeng
工具 :OllyDbg
声明:我是一个初学者,报着学习的目的来到这里希望大家多多指教!!!
前一个被意外加精,受到鼓励,再发一个。
1.运行程序,注册名与注册码只允许输入一个字符,通过readme得知这个crackeme,只允许输入一个字符,我们要修改它;
使用olly载入,无意发现EM_LIMITTEXT这个 wparam=通过修改这个可以解除限制,或nop掉;
试运行可以了
00401315 |. 6A 00 PUSH 0 ; /lParam = 0
00401317 |. 6A 01 PUSH 1 ; |wParam = 1
00401319 |. 68 C5000000 PUSH 0C5 ; |Message = EM_LIMITTEXT
0040131E |. 68 E9030000 PUSH 3E9 ; |ControlID = 3E9 (1001.)
00401323 |. 50 PUSH EAX ; |hWnd => NULL
00401324 |. E8 A1000000 CALL <JMP.&USER32.SendDlgItemMessageA> ; \SendDlgItemMessageA
00401329 |. 33C0 XOR EAX,EAX
0040132B |. A1 14324000 MOV EAX,DWORD PTR DS:[403214]
00401330 |. 6A 00 PUSH 0 ; /lParam = 0
00401332 |. 6A 01 PUSH 1 ; |wParam = 1
00401334 |. 68 C5000000 PUSH 0C5 ; |Message = EM_LIMITTEXT
00401339 |. 68 EA030000 PUSH 3EA ; |ControlID = 3EA (1002.)
0040133E |. 50 PUSH EAX ; |hWnd => NULL
0040133F |. E8 86000000 CALL <JMP.&USER32.SendDlgItemMessageA> ; \SendDlgItemMessageA
00401344 |. 58 POP EAX
在GetWindowTextLengthA上下断点,来到
004010C3 |. FF35 0C324000 PUSH DWORD PTR DS:[40320C] ; /hWnd = NULL
004010C9 |. E8 F0020000 CALL <JMP.&USER32.GetWindowTextLengthA> ; \GetWindowTextLengthA
004010CE |. B9 00000000 MOV ECX,0
004010D3 |. 83F8 13 CMP EAX,13
004010D6 |. 7F 43 JG SHORT KeygenMe.0040111B ;>13则 over
004010D8 |. 83F8 03 CMP EAX,3
004010DB |. 7E 3E JLE SHORT KeygenMe.0040111B ;<3 则over
所以上面的注册名wparam可以改为13h
004011E7 |. 50 PUSH EAX ; /hWnd => NULL
004011E8 |. E8 D1010000 CALL <JMP.&USER32.GetWindowTextLengthA> ; \GetWindowTextLengthA
004011ED |. B9 00000000 MOV ECX,0
004011F2 |. 83F8 18 CMP EAX,18
004011F5 |.^0F85 20FFFFFF JNZ KeygenMe.0040111B
注册码的wparam可以改为18h
ReadMe 还说 "Patch it, to stop closing after the registration procedure".
手动F8一步一步地运行了几次,发现都从这个地方跳死;
00401148 |. B8 00000000 MOV EAX,0 ; EAX清零
0040114D |. 83F8 00 CMP EAX,0 ;总是相等
00401150 |. 0F85 FF000000 JNZ KeygenMe.00401255 ;退出
00401156 |.^E9 CCFEFFFF JMP KeygenMe.00401027 ;重开始
我们把 MOV EAX,0 改为 MOV EAX,1 .
输入试练码
ainafeng
123456789012345678901234
开始
Olly 断在GetWindowTextLength
F8.
0040110F |. B8 0C304000 MOV EAX,KeygenMe.0040300C ; ASCII "ainafeng"
00401114 |. E8 B8010000 CALL KeygenMe.004012D1
关键call 004012D1
004012D1 /$ 8A10 MOV DL,BYTE PTR DS:[EAX]
004012D3 |. 6BC9 48 IMUL ECX,ECX,48
004012D6 |. 2BCA SUB ECX,EDX
004012D8 |. 83E9 6F SUB ECX,6F
004012DB |. 8BD1 MOV EDX,ECX
004012DD |. 81F1 AFAC0B00 XOR ECX,0BACAF
004012E3 |. 40 INC EAX
004012E4 |. 4B DEC EBX
004012E5 |. 83FB 00 CMP EBX,0
004012E8 |.^75 E7 JNZ SHORT KeygenMe.004012D1
004012EA \. C3 RETN
这个循环计算出注册码的一部分,继续往下走
0040116B |. 68 00304000 PUSH KeygenMe.00403000 ; /pBufCount =
00401170 |. 68 0C304000 PUSH KeygenMe.0040300C ; |Buffer =
00401175 |. E8 62020000 CALL <JMP.&ADVAPI32.GetUserNameA> ; \GetUserNameA
这个原来是调用系统的登陆名
0040127A /$ 55 PUSH EBP
0040127B |. 8BEC MOV EBP,ESP
0040127D |. 33C0 XOR EAX,EAX
0040127F |. 33DB XOR EBX,EBX
00401281 |. 8B45 08 MOV EAX,DWORD PTR SS:[EBP+8] ;上次的结果-〉eax
00401284 |. 8B5D 0C MOV EBX,DWORD PTR SS:[EBP+C] ;这次的结果-〉ebx
00401287 |. 8BD0 MOV EDX,EAX ;edx=eax
00401289 |. 33D3 XOR EDX,EBX ;edx=edx^ebx
0040128B |. 81F2 ACFF0000 XOR EDX,0FFAC ;edx=edx^0xFFAC
00401291 |. 81F3 53050000 XOR EBX,553 ;ebx=ebx^0x553
00401297 |. 03C3 ADD EAX,EBX ;eax=eax+ebx
00401299 |. 03DA ADD EBX,EDX ;ebx=ebx+edx
0040129B |. 4B DEC EBX ;ebx--
0040129C |. 03C3 ADD EAX,EBX ;eax=eax+ebx
0040129E |. C9 LEAVE
00401346 /$ A1 1C324000 MOV EAX,DWORD PTR DS:[40321C] ;第一个结果(r1)
0040134B |. 8B1D 18324000 MOV EBX,DWORD PTR DS:[403218] ;第二个结果(r2)
00401351 |. 3BC3 CMP EAX,EBX ;if(r1!=r2)
00401353 |. 75 0E JNZ SHORT KeygenMe.00401363
00401355 |. 81F3 8E000000 XOR EBX,8E ;r1==r2 ,ebx=ebx^0x8e
0040135B |. 03D8 ADD EBX,EAX ;ebx=ebx+eax
0040135D |. 891D 18324000 MOV DWORD PTR DS:[403218],EBX ;保存 r2
三。总结
1。注册码的格式
r2,x2,r1
2。注册码 的第三个四个和十四个字符的位置为“-”
r1=(r1*48h-sn-6f)^0XBACAF
r2=(r2*0x48-username-0x6f)^0XBACAF
x=r1;
x^=r2;
x^=0x0FFAC;
x1=r2^0x553;
x2=r1+tmp1;
x1=x1+x;
x1--;
x2=x2+x1;
然后前三个字符替换为KOS
3。可用的注册码
ainafeng
KOSA-48A0B0167-9174B2665
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!