逆向破解学习二之<TraceMe>
这次在破解TraceMe的时候,我有看过别人的视频。但是我并没有按照别人思路走,而是完全安全自己的思路试了一次。结果破解成功。新手学破解,如果有不对的地方,还请指出来。
004013A0 crackmes.<ModuleEntryPoint> /$ push ebp ; EP入口
004013A1 |. 8BEC mov ebp, esp ;保护数据,入栈。方便程序结束后返回
004013A3 |. 6A FF push -
004013A5 |. D0404000 push 004040D0
004013AA |. D41E4000 push 00401ED4 ; SE handler installation
004013AF |. :A1 mov eax, dword ptr fs:[]
004013B5 |. push eax
004013B6 |. : mov dword ptr fs:[], esp
004013BD |. 83EC sub esp,
004013C0 |. push ebx ;将参数压入桟
004013C1 |. push esi ;将参数压入桟
004013C2 |. push edi ;将参数压入桟
004013C3 |. E8 mov dword ptr ss:[ebp-], esp ;将当前桟数据取出保存地址
004013C6 |. FF15 call near dword ptr ds:[<&KERNEL32.Ge>; kernel32.GetVersion ;调用
004013CC |. 33D2 xor edx, edx ;Edx清0
004013CE |. 8AD4 mov dl, ah
004013D0 |. mov dword ptr ds:[], edx
004013D6 |. 8BC8 mov ecx, eax
004013D8 |. 81E1 FF000000 and ecx, 0FF
004013DE |. 890D mov dword ptr ds:[], ecx
004013E4 |. C1E1 shl ecx,
004013E7 |. 03CA add ecx, edx
004013E9 |. 890D mov dword ptr ds:[], ecx
004013EF |. C1E8 shr eax,
004013F2 |. A3 1C554000 mov dword ptr ds:[40551C], eax
004013F7 |. 33F6 xor esi, esi ;清0
004013F9 |. push esi ;将输入压桟
004013FA |. E8 A1090000 call 00401DA0 ;跟进去以后发现是heapcreate函数。创建辅助堆栈
004013FF |. pop ecx ;将ECX值取出
|. 85C0 test eax, eax ;比较EAX值,这个时候值永远是成立的。 垃圾指令,跳过
|. jnz short 0040140C ;EIP指向: 0040140C
|. 6A 1C push 1C
|. E8 B0000000 call 004014BB
0040140B |. pop ecx
0040140C |> FC mov dword ptr ss:[ebp-], esi
0040140F |. E8 E1070000 call 00401BF5
|. FF15 call near dword ptr ds:[<&KERNEL32.Ge>; [GetCommandLineA ;调用API
0040141A |. A3 185A4000 mov dword ptr ds:[405A18], eax
0040141F |. E8 9F060000 call 00401AC3
|. A3 mov dword ptr ds:[], eax
|. E8 call ;CALL没一个一个跟了,直接单步补过
0040142E |. E8 8A030000 call 004017BD
|. E8 A7000000 call 004014DF ;CALL没一个一个跟了,直接单步补过
|. D0 mov dword ptr ss:[ebp-], esi
0040143B |. 8D45 A4 lea eax, dword ptr ss:[ebp-5C] ;数据入栈,然后调用API
0040143E |. push eax ; /pStartupinfo
0040143F |. FF15 3C404000 call near dword ptr ds:[<&KERNEL32.Ge>; \GetStartupInfoA
|. E8 1B030000 call
0040144A |. 9C mov dword ptr ss:[ebp-], eax
0040144D |. F645 D0 test byte ptr ss:[ebp-],
|. je short
|. 0FB745 D4 movzx eax, word ptr ss:[ebp-2C]
|. EB jmp short 0040145C
|> 6A 0A push 0A 数据入栈,然后调用API
0040145B |. pop eax
0040145C |> push eax
0040145D |. FF75 9C push dword ptr ss:[ebp-]
|. push esi
|. push esi ; /pModule
|. FF15 call near dword ptr ds:[<&KERNEL32.Ge>; \GetModuleHandleA 数据入栈,然后调用API
|. push eax
|. E8 92FBFFFF call ;当运行到 程序弹出。

7E46B05E USER32.GetDlgItemTextA 8BFF mov edi, edi ; USER32.GetDlgItemTextA API地址
7E46B060 /. push ebp ;保存地址
7E46B061 |. 8BEC mov ebp, esp
7E46B063 |. FF75 0C push dword ptr ss:[ebp+C] ; /ControlID 参数入栈, ControlID
7E46B066 |. FF75 push dword ptr ss:[ebp+] ; |hWnd 参数入栈,hWnd
7E46B069 |. E8 0093FBFF call GetDlgItem ; \GetDlgItem 调用API,GetDlgItem。返回窗口中指定参数ID的子元素的句柄
7E46B06E |. 85C0 test eax, eax ;通过比较,判断以上是否正常,
7E46B070 |. 0E je short 7E46B080 ;标志位没改变。跳转没实现 继续走
7E46B072 |. FF75 push dword ptr ss:[ebp+] ; /Count 参数入栈
7E46B075 |. FF75 push dword ptr ss:[ebp+] ; |Buffer 参数入栈
7E46B078 |. push eax ; |hWnd 参数入栈
7E46B079 |. E8 ED70FCFF call GetWindowTextA ; \GetWindowTextA ;函数原形为:GetDlgItem(控件ID)->GetWindowText(eax); 7E46B07E |. EB 0E jmp short 7E46B08E ;段间短跳转。无条件跳到7E46B08E
7E46B080 |> 837D cmp dword ptr ss:[ebp+],
7E46B084 |. je short 7E46B08C
7E46B086 |. 8B45 mov eax, dword ptr ss:[ebp+]
7E46B089 |. C600 mov byte ptr ds:[eax],
7E46B08C |> 33C0 xor eax, eax
7E46B08E |> 5D pop ebp 将bp基址指针取出。
7E46B08F \. C2 retn RETURN to crackmes.004011B6

004011B6 . 8D8C24 9C000000 lea ecx, dword ptr ss:[esp+9C]
004011BD . 6A push ; /Count = (.) 将参数入栈
004011BF . push ecx ; |Buffer
004011C0 . E8030000 push 3E8 ; |ControlID = 3E8 (.)
004011C5 . push esi ; |hWnd
004011C6 . 8BD8 mov ebx, eax ; |
004011C8 . FFD7 call near edi ; \GetDlgItemTextA 返回到 GetDlgItemTextA 地址

//又进入了7E46B05E这个地址了。 7E46B05E USER32.GetDlgItemTextA 8BFF mov edi, edi
7E46B060 /. push ebp
7E46B061 |. 8BEC mov ebp, esp
7E46B063 |. FF75 0C push dword ptr ss:[ebp+C] ; /ControlID
7E46B066 |. FF75 push dword ptr ss:[ebp+] ; |hWnd
7E46B069 |. E8 0093FBFF call GetDlgItem ; \GetDlgItem
7E46B06E |. 85C0 test eax, eax
7E46B070 |. 0E je short 7E46B080
7E46B072 |. FF75 push dword ptr ss:[ebp+] ; /Count
7E46B075 |. FF75 push dword ptr ss:[ebp+] ; |Buffer
7E46B078 |. push eax ; |hWnd
7E46B079 |. E8 ED70FCFF call GetWindowTextA ; \GetWindowTextA
7E46B07E |. EB 0E jmp short 7E46B08E
7E46B080 |> 837D cmp dword ptr ss:[ebp+],
7E46B084 |. je short 7E46B08C
7E46B086 |. 8B45 mov eax, dword ptr ss:[ebp+]
7E46B089 |. C600 mov byte ptr ds:[eax],
7E46B08C |> 33C0 xor eax, eax
7E46B08E |> 5D pop ebp 改变基址指针
7E46B08F \. C2 retn ; 返回到 004011CA

004011CA . 8A4424 4C mov al, byte ptr ss:[esp+4C]
004011CE . 84C0 test al, al ;比较AL值
004011D0 . je short
004011D2 . 83FB cmp ebx, ;比较偏移地址值。应该就是我们输入的admin长度的值?
004011D5 . 7C jl short ; 我们来让他进行跳转,更改标志位
004011D7 . 8D5424 4C lea edx, dword ptr ss:[esp+4C] ;桟中取数据。
004011DB . push ebx ;将数据依次取出在压入桟。
004011DC . 8D8424 A0000000 lea eax, dword ptr ss:[esp+A0]
004011E3 . push edx;
这儿其实就相当于:
fucntion: xxxoo Cstring username = GetDlgItemTextA(idc1);
Cstring password = GetDlgItemTextA(idc2); if(lstrlen(username) > || lstrlen(password) > )
{
xxoo(username,password)
}
004011E4 . push eax 将数据依次取出在压入桟。
004011E5 . E8 call ;这儿是个WSprintfW调用。将用户写入到了另外一个变量里
004011EA . 8B3D BC404000 mov edi, dword ptr ds:[<&USER32.GetD>; USER32.GetDlgItem ;调用API
004011F0 . 83C4 0C add esp, 0C ;将桟大小抬高。
004011F3 . 85C0 test eax, eax ;比较返回值,跳转成立,标志位改变、。
004011F5 . je short 0040122E ;条件跳转。 该标志位,继续往下走。
004011F7 . 8D4C24 0C lea ecx, dword ptr ss:[esp+C]
004011FB . push ecx ; /String2
004011FC . E4544000 push 004054E4 ; |String1 = crackmes.004054E4;开辟空间
. FF15 call near dword ptr ds:[<&KERNEL32.ls>; \lstrcpyA ;拷贝字符串。
. 6A push ; /Enable = FALSE
. 6A 6E push 6E ; |/ControlID = 6E (.)
0040120B . push esi ; ||hWnd
0040120C . FFD7 call near edi ; |\GetDlgItem API参数,这儿做的应该就是将我们控件获取的字符串复制给了其他的变量了。
0040120E . 8B1D A4404000 mov ebx, dword ptr ds:[<&USER32.Enab>; |USER32.EnableWindow
. push eax ; |hWnd
. FFD3 call near ebx ; \EnableWindow
. 6A push ; /Enable = FALSE
. E8030000 push 3E8 ; |/ControlID = 3E8 (.)
0040121E . push esi ; ||hWnd
0040121F . FFD7 call near edi ; |\GetDlgItem
. push eax ; |hWnd
. FFD3 call near ebx ; \EnableWindow
. E8030000 push 3E8 ; /ControlID = 3E8 (.)
. push esi ; |hWnd
0040122A . FFD7 call near edi ; \GetDlgItem
0040122C . EB jmp short ;字符串拷贝完毕,准备跳转。


> push eax ; /hWnd
. FF15 A8404000 call near dword ptr ds:[<&USER32.SetF>; \SetFocus
. 6A push ; /BeepType = MB_OK
0040126A . FF15 AC404000 call near dword ptr ds:[<&USER32.Mess>; \MessageBeep
. 8B0D E0544000 mov ecx, dword ptr ds:[4054E0] ; crackmes.
. 6A push ; /lParam = NULL
. push ; |DlgProc = crackmes.
0040127D . push esi ; |hOwner
0040127E . 6A push ; |pTemplate =
. push ecx ; |hInst =>
. FF15 C8404000 call near dword ptr ds:[<&USER32.Dial>; \DialogBoxParamA 继续调用API,成功破解完毕。

逆向破解学习二之<TraceMe>的更多相关文章
- 20155305《网络对抗》PC平台逆向破解(二)
20155305<网络对抗>PC平台逆向破解(二) shellcode注入 1.shellcode shellcode是一段代码,溢出后,执行这段代码能开启系统shell. 2.构造方法 ...
- 20155311《网络对抗》PC平台逆向破解(二)
20155311<网络对抗>PC平台逆向破解(二) shellcode注入 什么是shellcode? shellcode是一段代码,溢出后,执行这段代码能开启系统shell. 前期准备- ...
- 20155307《网络对抗》PC平台逆向破解(二)
20155307<网络对抗>PC平台逆向破解(二) shellcode注入 什么是shellcode? shellcode是一段代码,溢出后,执行这段代码能开启系统shell. 前期准备- ...
- 20155334 网络对抗PC平台逆向破解(二)
注入Shellcode并运行攻击 shellcode就是一段机器指令(code) 通常这段机器指令的目的是为获取一个交互式的shell(像linux的shell或类似windows下的cmd.exe) ...
- 20145331魏澍琛 《网络对抗技术》 PC平台逆向破解
20145331魏澍琛 <网络对抗技术> PC平台逆向破解 学习任务 1.shellcode注入:shellcode实际是一段代码,但却作为数据发送给受攻击服务器,将代码存储到对方的堆栈中 ...
- 20155324《网络对抗》Exp1 PC平台逆向破解(5)M
20155324<网络对抗>Exp1 PC平台逆向破解(5)M 实验目标 本次实践的对象是一个名为~pwn1~的~linux~可执行文件. 该程序正常执行流程是:~main~调用~foo~ ...
- 2018-2019-2 20165237《网络攻防技术》Exp1 PC平台逆向破解
2018-2019-2 20165237<网络攻防技术>Exp1 PC平台逆向破解 一.实践目标 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调 ...
- 2018-2019-2 20165234 《网络对抗技术》 Exp1 PC平台逆向破解
实验一 PC平台逆向破解 实验目的 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任何用户输入的字符串. 该程序同时包含另 ...
- 20165221 《网络对抗技术》EXP1 PC平台逆向破解
20165221 <网络对抗技术>EXP1 PC平台逆向破解 一.实验内容 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函 ...
随机推荐
- Cocos2d-x Lua中使用标签
游戏场景中的文字包括了静态文字和动态文字.静态文字如下图所示游戏场景中①号文字“COCOS2DX”,动态文字如图4-1所示游戏场景中的②号文字“Hello World”.静态文字一般是由美工使用Pho ...
- Oracle备份一张表
数据库:myOnly 创建表:myTable 的备份表 myTable_tmpe create table myTable_tmpe as select * from myTable ; 补充: -- ...
- websocket集群情况下Nginx 代理出现的坑
那么问题的背景: A想给B发送socket 消息 ! A这消息 这时候被Nginx 轮询发到了C 服务器上! 擦! 这时候就蛋疼了! 要接收消息那个人在B服务器上! B就这样苦逼的收不 ...
- python系列十二:python3模块
#!/usr/bin/python # This Python file uses the following encoding: gbk #Python3 模块 '''用 python 解释器来编程 ...
- Java基础 - 流程控制语句
package com.demo4; /* * 流程控制语句 * 流程控制语句分类: * 顺序结构 * 代码从上往下按照顺序执行 * * 选择结构 * if * if (关系表达式1) { * 语句体 ...
- JS基础知识简介
使用js的三种方式 1.HTML标签内嵌js <button onclick="javascript:alert(真点啊)">有本事点我</button> ...
- MySQL版本与工具
MySQL各个版本区别 MySQL 的官网下载地址:http://www.mysql.com/downloads/ 在这个下载界面会有几个版本的选择. 1. MySQL Community Serve ...
- rgba透明的兼容处理
background-color: rgba(0, 0, 0, .6);filter: progid:DXImageTransform.Microsoft.gradient(startColorstr ...
- Linux CentOS使用yum安装Docker
Docker支持以下的CentOS版本: 目前,CentOS仅发行版本中的内核支持Docker. Docker运行在CentOS7上,要求系统为64位.系统内核版本为3.10以上. Docker运行在 ...
- win7安装composer
安装前请务必确保已经正确安装了 PHP.打开命令行窗口并执行 php -v 查看是否正确输出版本号. 开始安装前需要把open_ssl扩展打开 打开命令行并依次执行下列命令安装最新版本的 Compos ...