- UID
- 8671
注册时间2006-2-27
阅读权限40
最后登录1970-1-1
独步武林
TA的每日心情 | 开心 2018-5-6 16:27 |
---|
签到天数: 7 天 [LV.3]偶尔看看II
|
【破文标题】野猫III破解手记(算法分析1)
【破文作者】野猫III
【破解工具】PEiD,W32DASM,UC32,OD
【破解平台】Windows 2K&XP
【软件名称】CrackMe1
【软件大小】11.5KB
【原版下载】来源网上,总之不是自己做的!
【保护方式】注册码
【软件简介】给咱们菜鸟练手用...咱用来做个算法分析...
【破解声明】我是一只小小小小鸟WoWoWo...怎么飞呀飞不高WoWoWoOOOOOOOOOoOoooOOoOOOOOOOOOOooo
我乃小菜鸟一只,偶得一点心得,难免说得有误的地方,如是请指示,谢谢.
------------------------------------------------------------------------
所用注册信息:
所用的注册名:WildCatIII
所用的测试码:9876543210
一、运行这个Crackme输入错误注册信息有提示。。。
用PEID查无壳,软件是用Microsoft Visual Basic 5.0 / 6.0编定的。
二、用W32DASM反汇编参串:
"AKA-"
"KeyGen It Now"
"Try Again"
"You Get It"
"You Get Wrong"
"You Get Wrong" //这个
_______W32DASM_中______
:00402582 8945A4 mov dword ptr [ebp-5C], eax
:00402585 894DBC mov dword ptr [ebp-44], ecx
:00402588 8945B4 mov dword ptr [ebp-4C], eax
:0040258B 7458 je 004025E5 //关键跳转
* Possible StringData Ref from Code Obj ->"You Get It"
|
:0040258D 68801B4000 push 00401B80
:00402592 689C1B4000 push 00401B9C
:00402597 FFD7 call edi
:00402599 8BD0 mov edx, eax
:0040259B 8D4DE8 lea ecx, dword ptr [ebp-18]
:0040259E FFD3 call ebx
:004025A0 50 push eax
* Possible StringData Ref from Code Obj ->"KeyGen It Now"
|
:004025A1 68A81B4000 push 00401BA8
:004025A6 FFD7 call edi
:004025A8 8D4D94 lea ecx, dword ptr [ebp-6C]
:004025AB 8945CC mov dword ptr [ebp-34], eax
:004025AE 8D55A4 lea edx, dword ptr [ebp-5C]
:004025B1 51 push ecx
:004025B2 8D45B4 lea eax, dword ptr [ebp-4C]
:004025B5 52 push edx
:004025B6 50 push eax
:004025B7 8D4DC4 lea ecx, dword ptr [ebp-3C]
:004025BA 6A00 push 00000000
:004025BC 51 push ecx
:004025BD C745C408000000 mov [ebp-3C], 00000008
* Reference To: MSVBVM50.rtcMsgBox, Ord:0253h
|
:004025C4 FF1510414000 Call dword ptr [00404110]
:004025CA 8D4DE8 lea ecx, dword ptr [ebp-18]
* Reference To: MSVBVM50.__vbaFreeStr, Ord:0000h
|
:004025CD FF1580414000 Call dword ptr [00404180]
:004025D3 8D5594 lea edx, dword ptr [ebp-6C]
:004025D6 8D45A4 lea eax, dword ptr [ebp-5C]
:004025D9 52 push edx
:004025DA 8D4DB4 lea ecx, dword ptr [ebp-4C]
:004025DD 50 push eax
:004025DE 8D55C4 lea edx, dword ptr [ebp-3C]
:004025E1 51 push ecx
:004025E2 52 push edx
:004025E3 EB56 jmp 0040263B
* Referenced by a (U)nconditional or (C)onditional Jump at Address:
|:0040258B(C)
|
* Possible StringData Ref from Code Obj ->"You Get Wrong"
|
:004025E5 68C81B4000 push 00401BC8
:004025EA 689C1B4000 push 00401B9C
:004025EF FFD7 call edi
:004025F1 8BD0 mov edx, eax
:004025F3 8D4DE8 lea ecx, dword ptr [ebp-18]
:004025F6 FFD3 call ebx
:004025F8 50 push eax
* Possible StringData Ref from Code Obj ->"Try Again"
|
:004025F9 68E81B4000 push 00401BE8
:004025FE FFD7 call edi
:00402600 8945CC mov dword ptr [ebp-34], eax
:00402603 8D4594 lea eax, dword ptr [ebp-6C]
:00402606 8D4DA4 lea ecx, dword ptr [ebp-5C]
:00402609 50 push eax
:0040260A 8D55B4 lea edx, dword ptr [ebp-4C]
:0040260D 51 push ecx
:0040260E 52 push edx
:0040260F 8D45C4 lea eax, dword ptr [ebp-3C]
:00402612 6A00 push 00000000
:00402614 50 push eax
:00402615 C745C408000000 mov [ebp-3C], 00000008
++++++++++++++++++++++++++++
找到了转到错误提示信息地址:
:0040258B 7458 je 004025E5
三、在OD中载入,在上面一个地址前断点,运行到程序注册窗口,输入测试信息,确定,断点成功!
00402310 > \55 PUSH EBP
//完整点,在这断点。。。EBP=12f640
00402311 . 8BEC MOV EBP,ESP //ESP=12f64C
00402313 . 83EC 0C SUB ESP,0C //ESP-OC=12f640-0C=12F634
00402316 . 68 26104000 PUSH <JMP.&MSVBVM50.__vbaExceptHandler> ; SE 处理程序安装
//程序注册计算开始...
0040231B . 64:A1 0000000>MOV EAX,DWORD PTR FS:[0]
00402321 . 50 PUSH EAX
00402322 . 64:8925 00000>MOV DWORD PTR FS:[0],ESP
00402329 . 81EC B0000000 SUB ESP,0B0
~~~中间略~~~
00402401 . 53 PUSH EBX
00402402 . 50 PUSH EAX
00402403 . FF15 04414000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaHresu>; MSVBVM50.__vbaHresultCheckObj
00402409 > 8B95 50FFFFFF MOV EDX,DWORD PTR SS:[EBP-B0]
0040240F . 8B45 E4 MOV EAX,DWORD PTR SS:[EBP-1C] //注册名放进EAX
00402412 . 50 PUSH EAX ..........//压栈注册名
00402413 . 8B1A MOV EBX,DWORD PTR DS:[EDX]
00402415 . FF15 E4404000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaLenBs>; MSVBVM50.__vbaLenBstr
0040241B . 8BF8 MOV EDI,EAX
//把注册名位数送到EDI,咱用的注册名(WildCatIII)一共10位,16进制中用A表示
0040241D . 8B4D E8 MOV ECX,DWORD PTR SS:[EBP-18]
//注册名放进ECX
00402420 . 69FF FB7C0100 IMUL EDI,EDI,17CFB //注册名位数A乘以17CFB结果得EDI=CC1CE
00402426 . 51 PUSH ECX //压栈注册名
00402427 . 0F80 91020000 JO CrackMe1.004026BE //溢出转移
0040242D . FF15 F8404000 CALL DWORD PTR DS:[<&MSVBVM50.#516>] ; MSVBVM50.rtcAnsiValueBstr
00402433 . 0FBFD0 MOVSX EDX,AX
//先把注册名WildCatIII拆开,传送第一个字的16进制进EDX,"WildCatIII""W"字16进制表达为57h
00402436 . 03FA ADD EDI,EDX //EDX=57h EDI=EE1CEh 相加最终的EDI得EE225h
00402438 . 0F80 80020000 JO CrackMe1.004026BE //溢出转移
0040243E . 57 PUSH EDI //压栈EDI的值:EE225h
0040243F . FF15 E0404000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaStrI4>; MSVBVM50.__vbaStrI4
//这里Call进把EDI的16进制EE225h的值转换成10进制就得:975397,咱就不祥解啦...
00402445 . 8BD0 MOV EDX,EAX //所得结果为EAX,现在放进EDX中...
00402447 . 8D4D E0 LEA ECX,DWORD PTR SS:[EBP-20]
0040244A . FF15 70414000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaStrMo>; MSVBVM50.__vbaStrMove
00402450 . 8BBD 50FFFFFF MOV EDI,DWORD PTR SS:[EBP-B0]
00402456 . 50 PUSH EAX //压栈所得结果
.....先来个小结...现在这个EAX的结果是怎么来的呢?
是根据注册名的第一个字符ASCII码的16进制乘以地址:402420这里给的16进制值17CFB,所得的积然后再转换成10进制.
比如咱的名字:WildCatIII 其中第一个字符是W,用16进制表达就是57h,57*17CFB=EE225h=975397(10进制)
好啦...接下去...在这里为了简明一点,咱把假码简称为X,上面所得的这个积的结果称Y来代替...
00402457 . 57 PUSH EDI //
00402458 . FF93 A4000000 CALL DWORD PTR DS:[EBX+A4]
~~~中间代码略~~~
004024F2 . 8B0E MOV ECX,DWORD PTR DS:[ESI]
004024F4 . FF91 A0000000 CALL DWORD PTR DS:[ECX+A0]
004024FA . 85C0 TEST EAX,EAX
004024FC . 7D 12 JGE SHORT CrackMe1.00402510
004024FE . 68 A0000000 PUSH 0A0
00402503 . 68 5C1B4000 PUSH CrackMe1.00401B5C
00402508 . 56 PUSH ESI
00402509 . 50 PUSH EAX
0040250A . FF15 04414000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaHresu>; MSVBVM50.__vbaHresultCheckObj
00402510 > 8B45 E8 MOV EAX,DWORD PTR SS:[EBP-18] .....//EBP-18=假码(设为F)
00402513 . 8B4D E4 MOV ECX,DWORD PTR SS:[EBP-1C] .....//刚才上面分析计算出的结果(设为X)
00402516 . 8B3D 00414000 MOV EDI,DWORD PTR DS:[<&MSVBVM50.__vbaSt>; MSVBVM50.__vbaStrCat
0040251C . 50 PUSH EAX .......................//假码
0040251D . 68 701B4000 PUSH CrackMe1.00401B70 ; UNICODE "AKA-" //压栈"AKA-"字符,软件作者预设的(设为Y)
00402522 . 51 PUSH ECX .......................//压栈X
00402523 . FFD7 CALL EDI ; <&MSVBVM50.__vbaStrCat>
//从这里Call进真码组合,所得结果为YX = AKA-975397 。。。该码放在EAX中(真码)
00402525 . 8B1D 70414000 MOV EBX,DWORD PTR DS:[<&MSVBVM50.__vbaSt>; MSVBVM50.__vbaStrMove
0040252B . 8BD0 MOV EDX,EAX //真码现在放进EDX
0040252D . 8D4D E0 LEA ECX,DWORD PTR SS:[EBP-20]
00402530 . FFD3 CALL EBX ; <&MSVBVM50.__vbaStrMove>
00402532 . 50 PUSH EAX //压栈真码
00402533 . FF15 28414000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaStrCm>; MSVBVM50.__vbaStrCmp
00402539 . 8BF0 MOV ESI,EAX
0040253B . 8D55 E0 LEA EDX,DWORD PTR SS:[EBP-20]
~~~中间代码略~~~
00402585 . 894D BC MOV DWORD PTR SS:[EBP-44],ECX
00402588 . 8945 B4 MOV DWORD PTR SS:[EBP-4C],EAX
0040258B . 74 58 JE SHORT CrackMe1.004025E5 。。。。到了这里,关键跳转
0040258D . 68 801B4000 PUSH CrackMe1.00401B80 ; UNICODE "You Get It"
00402592 . 68 9C1B4000 PUSH CrackMe1.00401B9C ; UNICODE "
"
00402597 . FFD7 CALL EDI
00402599 . 8BD0 MOV EDX,EAX
0040259B . 8D4D E8 LEA ECX,DWORD PTR SS:[EBP-18]
0040259E . FFD3 CALL EBX
004025A0 . 50 PUSH EAX
004025A1 . 68 A81B4000 PUSH CrackMe1.00401BA8 ; UNICODE "KeyGen It Now"
004025A6 . FFD7 CALL EDI
004025A8 . 8D4D 94 LEA ECX,DWORD PTR SS:[EBP-6C]
004025AB . 8945 CC MOV DWORD PTR SS:[EBP-34],EAX
004025AE . 8D55 A4 LEA EDX,DWORD PTR SS:[EBP-5C]
004025B1 . 51 PUSH ECX
004025B2 . 8D45 B4 LEA EAX,DWORD PTR SS:[EBP-4C]
004025B5 . 52 PUSH EDX
004025B6 . 50 PUSH EAX
004025B7 . 8D4D C4 LEA ECX,DWORD PTR SS:[EBP-3C]
004025BA . 6A 00 PUSH 0
004025BC . 51 PUSH ECX
004025BD . C745 C4 08000>MOV DWORD PTR SS:[EBP-3C],8
004025C4 . FF15 10414000 CALL DWORD PTR DS:[<&MSVBVM50.#595>] ; MSVBVM50.rtcMsgBox
004025CA . 8D4D E8 LEA ECX,DWORD PTR SS:[EBP-18]
004025CD . FF15 80414000 CALL DWORD PTR DS:[<&MSVBVM50.__vbaFreeS>; MSVBVM50.__vbaFreeStr
004025D3 . 8D55 94 LEA EDX,DWORD PTR SS:[EBP-6C]
004025D6 . 8D45 A4 LEA EAX,DWORD PTR SS:[EBP-5C]
004025D9 . 52 PUSH EDX
004025DA . 8D4D B4 LEA ECX,DWORD PTR SS:[EBP-4C]
004025DD . 50 PUSH EAX
004025DE . 8D55 C4 LEA EDX,DWORD PTR SS:[EBP-3C]
004025E1 . 51 PUSH ECX
004025E2 . 52 PUSH EDX
004025E3 . EB 56 JMP SHORT CrackMe1.0040263B
004025E5 > 68 C81B4000 PUSH CrackMe1.00401BC8 ; UNICODE "You Get Wrong"
//上面关键跳转的地方跳到这里
004025EA . 68 9C1B4000 PUSH CrackMe1.00401B9C ; UNICODE ""
004025EF . FFD7 CALL EDI
004025F1 . 8BD0 MOV EDX,EAX
004025F3 . 8D4D E8 LEA ECX,DWORD PTR SS:[EBP-18]
004025F6 . FFD3 CALL EBX
004025F8 . 50 PUSH EAX
004025F9 . 68 E81B4000 PUSH CrackMe1.00401BE8 ; UNICODE "Try Again"
004025FE . FFD7 CALL EDI
00402600 . 8945 CC MOV DWORD PTR SS:[EBP-34],EAX
~~~中间略~~~
00402614 . 50 PUSH EAX
00402615 . C745 C4 08000>MOV DWORD PTR SS:[EBP-3C],8
0040261C . FF15 10414000 CALL DWORD PTR DS:[<&MSVBVM50.#595>] ; MSVBVM50.rtcMsgBox
//从这里Call飞,OVER!
~~~中间代码略~~~
++++注册名的第一个字母W的十六进制57h第一个Call40243F来到下面+++++++
7629BECF > 83EC 04 SUB ESP,4 //ESP减4,到最下面再加4,然后返回主程序
7629BED2 8D4424 00 LEA EAX,DWORD PTR SS:[ESP]
//把ESP偏移地址双字节的值存到EAX,也就是注册名W的16进制的值57h存到EAX中
7629BED6 50 PUSH EAX //压栈注册名第一个字母
7629BED7 6A 00 PUSH 0
7629BED9 E8 5BF5FEFF CALL MSVBVM50.7628B439
7629BEDE 50 PUSH EAX //压栈比较名R
7629BEDF FF7424 14 PUSH DWORD PTR SS:[ESP+14] //压栈注册名第一位
7629BEE3 FF15 641A2876 CALL DWORD PTR DS:[<&OLEAUT32.#110>] ; OLEAUT32.VarBstrFromI4
//Call进比较,咱们F7进入看看...
7629BEE9 85C0 TEST EAX,EAX
7629BEEB 0F8C E5FE0400 JL MSVBVM50.762EBDD6 //小于转移
7629BEF1 8B4424 00 MOV EAX,DWORD PTR SS:[ESP] //EDI转换成10进制
7629BEF5 83C4 04 ADD ESP,4 //ESP在这里加4
7629BEF8 C2 0400 RETN 4 //返回主程序
7629BEFB 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8]
7629BEFF 68 FF7F0000 PUSH 7FFF
7629BF04 FF7424 08 PUSH DWORD PTR SS:[ESP+8]
7629BF08 E8 03000000 CALL MSVBVM50.7629BF10
7629BF0D C2 0800 RETN 8
++++++++++F7来到这里+++++++++++++++
77993F05 > 8B4C24 04 MOV ECX,DWORD PTR SS:[ESP+4] //ESP+4=W (注册名第一位) ee225h 进ECX
77993F09 83EC 50 SUB ESP,50 //减去50
77993F0C 8D4424 00 LEA EAX,DWORD PTR SS:[ESP] //与之比较的数据进EAX 2052h
77993F10 50 PUSH EAX //压栈EAX
77993F11 51 PUSH ECX //压栈ECX
77993F12 E8 15000000 CALL OLEAUT32.77993F2C //Call咱们F7进去
77993F17 8D4424 00 LEA EAX,DWORD PTR SS:[ESP]
77993F1B 8B5424 60 MOV EDX,DWORD PTR SS:[ESP+60]
77993F1F 52 PUSH EDX
77993F20 50 PUSH EAX
77993F21 E8 3DFFFFFF CALL OLEAUT32.77993E63
77993F26 83C4 50 ADD ESP,50
77993F29 C2 1000 RETN 10
77993F2C 8B4424 04 MOV EAX,DWORD PTR SS:[ESP+4] //Call来这里 //首字母进EAX
77993F30 33C9 XOR ECX,ECX //清空ECX
77993F32 85C0 TEST EAX,EAX
77993F34 56 PUSH ESI
77993F35 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C]
77993F39 0F9CC1 SETL CL
77993F3C 51 PUSH ECX
77993F3D 56 PUSH ESI
77993F3E 50 PUSH EAX
77993F3F E8 AFFEFFFF CALL OLEAUT32.77993DF3
77993F44 8BC6 MOV EAX,ESI
77993F46 5E POP ESI
77993F47 C2 0800 RETN 8 //主程序返回
+++++++++++++++++++++++++++++++++++++++++++++++
来到这下面:(——————————————————————————)
77993DF3 8B4424 0C MOV EAX,DWORD PTR SS:[ESP+C]
77993DF7 8B4C24 08 MOV ECX,DWORD PTR SS:[ESP+8]
77993DFB 53 PUSH EBX
77993DFC 56 PUSH ESI
77993DFD 85C0 TEST EAX,EAX
77993DFF 57 PUSH EDI
77993E00 75 51 JNZ SHORT OLEAUT32.77993E53
77993E02 8B7424 10 MOV ESI,DWORD PTR SS:[ESP+10] //首字母进ESI
77993E06 8BD9 MOV EBX,ECX //ECX进EBX
77993E08 8BC6 MOV EAX,ESI //ESI进EAX
77993E0A 33D2 XOR EDX,EDX //清空EDX
77993E0C BF 0A000000 MOV EDI,0A //注册名位数进EDI
77993E11 83C1 02 ADD ECX,2 //ECX加2=12F502
77993E14 F7F7 DIV EDI //无符号除法
77993E16 B8 CDCCCCCC MOV EAX,CCCCCCCD //CCCCCCCD 进EAX
77993E1B 8BFA MOV EDI,EDX //EDX进EDI
77993E1D F7E6 MUL ESI //无符号乘法
77993E1F C1EA 03 SHR EDX,3 //逻辑右移3位 BE81D-17D03
77993E22 83C7 30 ADD EDI,30 //EDI+30=37
77993E25 8BF2 MOV ESI,EDX //EDX进ESI
77993E27 66:8979 FE MOV WORD PTR DS:[ECX-2],DI
77993E2B 85F6 TEST ESI,ESI
77993E2D ^ 77 D9 JA SHORT OLEAUT32.77993E08 //与77993E08构成循环
77993E2F 66:C701 0000 MOV WORD PTR DS:[ECX],0
77993E34 83E9 02 SUB ECX,2
77993E37 66:8B13 MOV DX,WORD PTR DS:[EBX]
77993E3A 66:8B01 MOV AX,WORD PTR DS:[ECX]
77993E3D 66:8911 MOV WORD PTR DS:[ECX],DX
77993E40 66:8903 MOV WORD PTR DS:[EBX],AX
77993E43 83E9 02 SUB ECX,2
77993E46 83C3 02 ADD EBX,2
77993E49 3BD9 CMP EBX,ECX
77993E4B ^ 72 EA JB SHORT OLEAUT32.77993E37
77993E4D 5F POP EDI
77993E4E 5E POP ESI
77993E4F 5B POP EBX
77993E50 C2 0C00 RETN 0C //返回
------------------------------------------------------------------------
菜鸟心得:注册名的ASCII码先转换成16进制,再转换成10进制,在寄存器中看到的就是它的真正数值!
77993E08 8BC6 MOV EAX,ESI
算法心得:
注册名: WildCatIII <------
在40241B处位数10位,16进制中为A,
在402420处注册名位数A乘以17CFB积得CC1CE,
在402433处取注册名首字母W的16位表达值57,在402436与上面所得的积相加得:EE225
在40243F这个Call里转换成10进制得975397,这个结果在402523位置与软件作者预定的AKA-相组合得最终注册码:AKA-975397
从这个简单的算法来看,注册过程中只提取用户名位数,检验用户名首字符,所以如果满足了这两个条件注册码还是一样的。。。
用咱的注册名引出的例子如:
注册名:W123456789 <--10位且第一个字母为W,所以一样的注册成功!
注册码:AKA-975397
-----------------------------------------------------------------------
【版权声明】本破文纯属技术交流, 转载请注明作者并保持文章的完整, 谢谢!
[ 本帖最后由 野猫III 于 2006-7-14 00:12 编辑 ] |
|