成都信息工程学院第八届信息安全技术大赛pushbox爆破分析

下载地址:https://files.cnblogs.com/tk091/pushbox.rar

首先,这个程序没有任何可以输入注册码信息的地方,那么首先就可以考虑
文件key形式。

用c32打开,搜索File或者Reg,看看是不是注册表或者文件的形式验证。

我在其中很快就搜索到:CreateFileA

用OD载入,输入
bp CreateFileA

Alt+B打开断点窗口,果然有一个断点。

shift+F9运行程序,按步骤找到“开始”按钮,按下
程序被CreateFileA断下,alt+F9返回到程序领空。

 1 0040140F  |.  50            push eax                                 ; /hTemplateFile => NULL
 2 00401410  |.  68 80000000   push 0x80                                ; |Attributes = NORMAL
 3 00401415  |.  6A 03         push 0x3                                 ; |Mode = OPEN_EXISTING
 4 00401417  |.  50            push eax                                 ; |pSecurity => NULL
 5 00401418  |.  8D7C24 1C     lea edi,dword ptr ss:[esp+0x1C]          ; |
 6 0040141C  |.  6A 01         push 0x1                                 ; |ShareMode = FILE_SHARE_READ
 7 0040141E  |.  68 00000080   push 0x80000000                          ; |Access = GENERIC_READ
 8 00401423  |.  68 48604000   push pushbox.00406048                    ; |FileName = "not_key.txt"
 9 00401428  |.  F3:AB         rep stos dword ptr es:[edi]              ; |
10 0040142A  |.  FF15 08504000 call dword ptr ds:[<&KERNEL32.CreateFile>; \CreateFileA
11 00401430  |.  8BF0          mov esi,eax
12 00401432  |.  83FE FF       cmp esi,-0x1
13 00401435  |.  74 20         je Xpushbox.00401457                     ;  文件不存在,则跳出
14 00401437  |.  8D4424 08     lea eax,dword ptr ss:[esp+0x8]
15 0040143B  |.  6A 00         push 0x0                                 ; /pOverlapped = NULL
16 0040143D  |.  50            push eax                                 ; |pBytesRead
17 0040143E  |.  8D4C24 14     lea ecx,dword ptr ss:[esp+0x14]          ; |
18 00401442  |.  6A 1E         push 0x1E                                ; |BytesToRead = 1E (30.)
19 00401444  |.  51            push ecx                                 ; |Buffer
20 00401445  |.  56            push esi                                 ; |hFile
21 00401446  |.  FF15 04504000 call dword ptr ds:[<&KERNEL32.ReadFile>] ; \ReadFile

我们在上面看到了key文件,文件名为not_key.txt,我们在该程序目录下创建一个not_key.txt,文件内容为空。

重新载入程序。
(注意,刚才的断点还存在)
继续跳到刚才的位置(这次文件就存在了)
BytesToRead,要读取的字节数,为30字节,我们在key文件中写入30个字节(比如30个0)。
在key写入的时候需要关闭od,写入完成后,重新载入程序。

继续跳到刚才的位置。

现在的情况是,key文件存在,且key的内容的长度是正确的。
我们继续往下。

 1 00401468  |.  8D5424 0C     lea edx,dword ptr ss:[esp+0xC]           ;  读取注册码
 2 0040146C  |.  6A 78         push 0x78
 3 0040146E  |.  52            push edx
 4 0040146F  |.  E8 8CFBFFFF   call pushbox.00401000                    ;  可能的算法call或验证call
 5 00401474  |.  83C4 08       add esp,0x8
 6 00401477  |.  85C0          test eax,eax
 7 00401479  |.^ 74 DC         je Xpushbox.00401457
 8 0040147B  |.  8BB424 140100>mov esi,dword ptr ss:[esp+0x114]
 9 00401482  |.  8B3D 00514000 mov edi,dword ptr ds:[<&USER32.SetDlgIte>;  USER32.SetDlgItemTextA
10 00401488  |.  68 34604000   push pushbox.00406034                    ; /Text = "tech.cuit.edu.cn"
11 0040148D  |.  6A 6E         push 0x6E                                ; |ControlID = 6E (110.)
12 0040148F  |.  56            push esi                                 ; |hWnd
13 00401490  |.  FFD7          call edi                                 ; \SetDlgItemTextA


00401479 |.^\74 DC je pushbox.00401457 ; 关键跳
这里就是我们的关键跳了。如果要爆破,把这里nop掉就OK了(当然,key文件还是需要的)。

原文地址:https://www.cnblogs.com/tk091/p/2478002.html