处女贴,庆贺自己拿到鸡和马,发一个很简单的CrackMe分析,过程很简单,路过的大神勿喷!
stage1:简单的找出字符
stage2:根据输入的注册名和序列号进行相应的计算
stage3:移除一段字符的打印
利用IDA打开该exe后,第一步看到需要输入的字符长度为8
mov dword ptr [esp], offset aEnterPasswordT ; "Enter Password To Continue : "
call printf
lea eax, [ebp+var_28]
mov [esp+4], eax
mov dword ptr [esp], offset aS ; "%s"
call scanf
lea eax, [ebp+var_28]
mov [esp], eax ; char *
call strlen
cmp eax, 8
jz short Var_C_ZERO
接着对输入的字符的ascii码逐个地址1
.text:004013D0 AddOne: ; CODE XREF: _main+164j
.text:004013D0 cmp [ebp+var_C], 7
.text:004013D4 jg short CallCmp
.text:004013D6 lea eax, [ebp+var_8]
.text:004013D9 add eax, [ebp+var_C]
.text:004013DC lea edx, [eax-20h]
.text:004013DF lea eax, [ebp+var_8]
.text:004013E2 add eax, [ebp+var_C]
.text:004013E5 sub eax, 20h
.text:004013E8 movzx eax, byte ptr [eax]
.text:004013EB inc al
.text:004013ED mov [edx], al
.text:004013EF lea eax, [ebp+var_C]
.text:004013F2 inc dword ptr [eax]
.text:004013F4 jmp short AddOne
接着就是cmp了:
.text:004013F6 CallCmp: ; CODE XREF: _main+144j
.text:004013F6 lea eax, [ebp+var_38] ; 程序中要对比的原始字符串:QbTTx1sE
.text:004013F9 lea edx, [ebp+var_28] ; 输入的字符串ASCII加1后的结果
.text:004013FC mov [esp+4], eax ; char *
.text:00401400 mov [esp], edx ; char *
.text:00401403 call strcmp
.text:00401408 test eax, eax
.text:0040140A jnz WrongAnswer
stage1算是完成了,接着进入stage2
stage2简单的来说就是先计算Name的长度,然后for循环逐个字符的ASCII码减1
.text:00401480 loc_401480: ; CODE XREF: _main+218j
.text:00401480 lea eax, [ebp+var_48]
.text:00401483 mov [esp], eax ; char *
.text:00401486 call strlen
.text:0040148B cmp [ebp+var_C], eax
.text:0040148E ja short IsResolveStage2
.text:00401490 lea eax, [ebp+var_8]
.text:00401493 add eax, [ebp+var_C]
.text:00401496 sub eax, 40h
.text:00401499 movsx eax, byte ptr [eax]
.text:0040149C add eax, [ebp+var_4C]
.text:0040149F dec eax
.text:004014A0 mov [ebp+var_4C], eax
.text:004014A3 lea eax, [ebp+var_C]
.text:004014A6 inc dword ptr [eax]
.text:004014A8 jmp short loc_401480
简单用python写了个keygen:
#coding:gbk
import os
NAME = "XXX"
count = 0
for i in xrange(len(NAME)):
count += ord(NAME[i])
count -= (len(NAME) + 1);
print count
好吧stage2完成了,接着是stage3,就是移除一串字符的printf,就是将如下的call进行填充
.text:004014E7 mov dword ptr [esp], offset aStage3Complete ; "\nStage 3 Completed if you don't see nag"...
.text:004014EE call printf
这个在IDA中暂时不知道该如何填错nop,希望知道的指点一下,这个在od中简单解决了下。
好吧,这个CrackMe算是基本解决了
附上这个CrackMe
CrackMe#1.7z
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)