/go_parser

Yet Another Golang binary parser for IDAPro

Primary LanguagePythonMIT LicenseMIT

Yet Another Golang binary parser for IDAPro

中文 | English


golang_loader_assistjeb-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);
  6. 以上功能对于 buildmode=pie 类型的 Go binary 文件依然有效。

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);.

Note

  1. 此工具只在 IDA7.2/IDA7.0 上测试过,其他的 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