受欢迎的博客标签

逆向工程系列-exe反编译工具

Published

1.如何拆解EXE文件?

With a debugger you can step through the program assembly interactively.
With a disassembler, you can view the program assembly in more detail.
With a decompiler, you can turn a program back into partial source code, assuming you know what it was written in (which you can find out with free tools such as PEiD - if the program is packed, you'll have to unpack it first OR Detect-it-Easy if you can't find PEiD anywhere. DIE has a strong developer community on github currently).

静态分析工具(Disassemblers)

1.1 首推IDA,有了它其他的反汇编工具基本用不着。

using IDA (Interactive Disassembler) is probably the best disassembler, that'll get you asm code. but you'l have to learn asm.

1.2 IDA Pro

Good news. IDA Pro 7.0 is actually free for its older versions now: http://www.hex-rays.com/idapro/idadownfreeware.htm

 

动态调试工具(Debuggers)

        动态调试工具有ODwindbg。 调试应用层程序两个调试器都可以,OD因为主要面向逆向,窗口布局更为合理直观且插件众多,所以一般情况下都首选OD,windbg没那么方便,大部分操作通过命令来进行,但它也有它的优势,各种命令(内置命令、元命令和扩展命令)提供了强大的控制和分析能力,所以windbg有时也会用到。如果要调试内核程序或模块那OD就无能为力了,windbg可以说是唯一的选择

侦壳工具(Unpacker)

 侦壳工具一般用PEid,其他的工具也有,这里就不列出了。PEid功能强大,但很多时候也分析不准,不能过于相信它的结果。主要还是通过自己的分析来判断。

PEiD is the best tool to use to detect the packer. By analyzing the entropy, PEiD can detect whether the application is packed or not.
 

2.对特定功能部分的分析流程

一般的流程是这样的,在拿到一个未知的exe之后。

Step 1:先丢进ExeinfoPe进行简单的查看,先看是否有壳,有壳脱壳再查看一次。

PEid
ExeinfoPe
DIE(Detect It Easy)  https://github.com/horsicq/Detect-It-Easy

然后根据信息判断是否为native程序,如果是,再仔细查看区段和导入导出表和一些其他信息得到一个该程序的大概功能的印象。
如果不是native程序,或者该程序所用开发工具有专有工具,使用对应工具解析。像是dnspy/dede之类的。如果是,丢进ollydbg/x64dbg中先扫一下字符串,虽然这个操作很咸鱼,但是很有用,很容易找到一些有用的信息。再丢进ida pro里,跟踪main函数和有疑点的系统函数的调用方以及可疑字符串相关的代码。
定位到想要研究的部分,进行该部分代码的逆向、取证、修改或者其他你需要进行的工作。

step 2:if the program is packed, you'll have to unpack it first.

step 3:

查看程序是用什么语言编的方法

如果导入了msvcr100.dll之类的,很可能是vc编的,
如果资源里有TForm之类的,很可能是delphi编的,
如果导入了msvbm60.dll,则是vb6,
如果有两个.data节,一个还是可执行的,另一个放一堆如找不到fnr之类的错误文字,那就是犀利的易语言。
如果文件头部有Rich字样,那么就是用微软的连接器产生的。

 

3.MFC逆向流程

查找按钮事件

查找对应消息

 

step 1:首先用Resource Hacker查找mfc .exe程序资源,得到Resource

download web site:https://portableapps.com/apps/utilities/resource-hacker-portable

 

ResourceHacker是一个32位与64位的资源编辑器,它既是一个资源编译器(对于.rc文件),也是一个反编译器——支持查看和编辑可执行文件中的资源(* .exe;. dll;)以及已编译的资源库(.res;.mui)。ResourceHacker既支持GUI模式也支持命令行模式。

 

 

https://blog.csdn.net/Sanky0u/article/details/81568483

 

other tools:

MfcSpy----用来找MFC程序的按钮事件

 

PEiD查壳

https://blog.csdn.net/weixin_42263657/article/details/84777834

 

Decompilers

1.在反编译Delphi时,PE-Expoler和DEDE配合使用,查看入口相当方便。

2.IDA Pro+Hex Rays Decompiler

You will usually not get good C++ out of a binary unless you compiled in debugging information. 

There's an add-on to it called Hex-Rays Decompiler that will decompile the rest of the way into C/C++. source.

2.1 反编译MFC这样的程序比较好的工具 IDA Pro蛮好用的,静态调试工具的王者理所应当是功能极为强大的IDA Pro;

IDA Pro must be one of the best reverse engineering tools. It is an interactive disassembler.

IDA Pro是一款强大的反汇编软件,特有的IDA视图和交叉引用,可以方便理解程序逻辑和快速定位代码片断,以方便修改。

2.2 Hex Rays Decompiler

It's a plugin which adds assembler to C decompiler to IDA.This is a Hexrays Decompiler, which is a plugin for the Interactive Disassembler (hexrays.com). It decompiles machine code into Pseudo-C code.

它是由HEX RAY SA 公司开发的,一家多年以来从事二进制代码反编译C的软件安全公司,其公司的旗舰产品就是著名的Hex-Rays.Decompiler(是IDA PRO的插件)

 

2.3反编译出(伪)C代码

他的hexray插件支持x86/x64/arm/arm64/mips的反编译,在一个函数上按一下F5就出来(伪)C代码了,还可以在反编译出来的代码上下断点调试

反编译成C插件

https://github.com/REhints/HexRaysCodeXplorer/releases

 

 

How to use

https://blog.csdn.net/Eastmount/article/details/98789742

 

2.4 IDA Pro+IDA FLIRT/FLAIR

FLIRT是IDA提供的一种函数识别技术,即库文件快速识别与鉴定技术(Fast Library Identification and Recognition Technology)。这项技术使IDA能在一系列编译器的标准库文件里自动找出调用的函数,使反汇编清单清晰明了。比如说一个MFC库函数,反汇编出来可能就是call 40a936,但是IDA可以通过FLIRT识别函数特征,从而标记该函数,并在反汇编窗口中显示为call CWnd::DestroyWindow,大大增加了代码的可读性,加快分析速度。

how to use

https://www.cnblogs.com/zUotTe0/p/12729390.html

 

MFCSpy 直接可以解析出按钮地址

官网:download: https://www.hex-rays.com/products/ida/support/download_demo.shtml MFCSpy 直接可以解析出按钮地址;

把那个放大镜拖到mfc写的程序的窗口上,如securecrt,vc6等,
松开鼠标就能看到一些内部函数地址了。
如oninitdialog,onok什么的一目了然。
拖到子窗口如铵钮上时,可以看出其id,当然,这个工作也可以由spy++完成。
结合其父窗口message map的输出,还可以知道当点击这个按钮时,会跳到哪段程序上执行

 

OllyDBG,可以用OD去反编译,就动态调试而言,OD更为灵活和强大。

OllyDbg is a 32-bit assembler level analyzing debugger for Microsoft Windows. Emphasis on binary code analysis makes it particularly useful in cases where the source is unavailable.

OD调试学习笔记7—去除未注册版软件的使用次数限制(1-7)

LordPE pe_view

3.Process Monitor

download:https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

文件和注册表监视工具一般用process monitor,以前是用Filemon监视文件,Regmon监视注册表,现在process monitor可以监视两种操作。其实这些工具都是同一个人写的,现在两个工具合并成一个了。说句题外话,这个作者就是写《深入解析windows操作系统》的作者,这本书的权威性对搞windows内核开发的可以说无人不晓,做逆向的话也很有必要好好读读这本书。

https://technet.microsoft.com/en-us/sysinternals/bb896645 download url 用Process Monitor查看一个http请求都读取了哪些文件的例子。 打开Process Monitor,点击“Filter”,然后添加以下几个过滤条件“Include Process Name is Apache.exe”(我用的Web Server是apache),"Include Operation is ReadFile", "Include Event Class is File System" 点击OK。

 4.具Reflector 支持四种语言:IL,VB.net,C#,Delphi http://www.aisto.com/roeder/dotnet/ .

 

Useful links

windows程序逆向工具汇总

https://blog.csdn.net/joeleechj/article/details/7983302

exe-unpack-tools software

https:/pan.baidu.com/s/1pOlXutVQ4AbYoQ-02D5stw 提取码:1111

逆向工程基础

Best Reverse Engineering Tools 

https://www.apriorit.com/dev-blog/366-software-reverse-engineering-tools

https://www.apriorit.com/dev-blog/364-how-to-reverse-engineer-software-windows-in-a-right-way

 

Is it possible to “decompile” a Windows .exe? Or at least view the Assembly?(good))