Skip to content
项目

关于

又一个用于 IDAPro 的 Golang 二进制解析器

开发工具

这些数字如何统计

可以做什么

  • Locate and parse firstmoduledata structure in Go binary file, and make comment for each field;
  • Locate pclntab(PC Line Table) according to the firstmoduledata and parse it. Then find and parse and recover function names and source file paths in the pclntab. Source file paths will be printed in the output window of IDAPro;
  • Parse strings and string pointers, make comment for each string, and make dref for each string pointer;
  • According to firstmoduledata, find each type and parse it, meke comment for each attribute of type, which will be very convenient for malware researcher to analyze a complex type or data structure definition;

实测星标增长

24小时
0
7天
0
15天
-1
1个月
-4

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README_cn.md

原文

Yet Another Golang binary parser for IDAPro

English | 中文


注意:

最新的 master 分支为 Python3 版,以前的 master 分支已重命名为 py2 分支,并且暂停维护。

Python3 版本使用说明

此版本是在 macOS/Windows 上 IDA7.4+, python3.8.x 版本测试通过,如果在其他平台上测试存在问题,欢迎提issue 或者 PR。

另外需要注意,macOS 上 IDA7.4+ 是使用系统默认安装的 Python3,这样可能导致自己安装的第三方库无法加载,需要切换到 brew 安装的 Python,具体的切换方法请参考这个脚本


受 golang_loader_assist 和 jeb-golang-analyzer 启发,为 IDAPro 写了一个更完备的 Go 二进制文件解析工具。

核心功能:

  1. 自动定位 firstmoduledata 的位置并解析;
  2. 根据 firstmoduledata 中的信息定位到 pclntab(PC Line Table),并从 pclntab 入手解析、恢复函数符号,抽取源码文件列表;
  3. 解析 strings 和 string pointers;
  4. 根据 firstmoduledata 中的信息,解析所有 types 并为 types 各种属性打上有意义的 comment 或 dref;
  5. 解析 itab(Interface Table)。

Go 语言二进制文件中对逆向分析有帮助的信息如下:

另外,go_parser 还有两个很有用的特性:

  1. 以上功能对于 buildmode=pie 类型的 Go binary 文件依然有效;
  2. 对于文件头信息尤其是 Section Header 信息损坏的二进制文件依然有效。

DDGMiner v5029 (MD5: 95199e8f1ab987cd8179a60834644663) 样本中核心的配置文件 struct 解析结果示例如下:

样本源码文件列表:

文件列表:

  • go_parser.py :整套工具的入口文件,在 IDAPro 中 [Alt+F7] 组合键,执行此脚本;
  • common.py: 通用变量和函数定义;
  • pclntbl.py: 解析 pclntab(PC Line Table);
  • strings.py: 解析 strings 和 string pointers;
  • moduldata.py: 解析 firstmoduledata;
  • types_builder.py: 解析所有 types ;
  • itab.py: 解析 itab(Interface Table);

另外, str_ptr.py 可以通过手动指定字符串指针数据的起始、结束位置来解析字符串指针。

Note

  1. 此版本在 IDA7.4+, Python3.8.x 上测试过,其他的 IDA 版本未经测试;
  2. strings 解析模块从 golang_loader_assist 移植过来,我自己又增加了 string pointers 解析的功能,目前只支持 x86 架构。

Refer

  1. Analyzing Golang Executables
  2. Reversing GO binaries like a pro
  3. Reconstructing Program Semantics from Go binaries.pdf
  4. Go二进制文件逆向分析从基础到进阶——综述
  5. Go二进制文件逆向分析从基础到进阶——MetaInfo、函数符号和源码文件路径列表
  6. Go二进制文件逆向分析从基础到进阶——数据类型
  7. Go二进制文件逆向分析从基础到进阶——itab与strings
  8. Go二进制文件逆向分析从基础到进阶——Tips与实战案例

探索相关项目

加载中…