JusticeRage/Manalyze

GitHub: JusticeRage/Manalyze

用于 Windows PE 可执行文件静态分析的跨平台工具,通过插件架构实现编译器识别、加壳检测、可疑导入分析等功能,帮助安全研究人员快速评估可疑二进制文件。

Stars: 1107 | Forks: 164

# Manalyze [![文档](https://readthedocs.org/projects/manalyze/badge/?version=latest)](https://docs.manalyzer.org/en/latest/) ## 简介 Manalyze 是一款用于 PE 文件的静态分析工具,可用于对可执行文件(或一组可执行文件)进行初步评估。它收集可能表明恶意行为的弱信号,并显示有助于后续手动分析的信息。 如果您想查看该工具生成的一些示例报告,欢迎试用我为它创建的 Web 服务:[manalyzer.org](https://manalyzer.org)。 ## 目录 - [PE 文件静态分析器](#a-static-analyzer-for-pe-file) - [如何构建](#how-to-build) - [生成 ClamAV 规则](#generating-clamav-rules) - [使用方法](#usage) - [Manalyze 的使用者](#people-using-manalyze) - [联系方式](#contact) ## PE 文件静态分析器 Manalyze 使用 C++ 编写,适用于 Windows 和 Linux,并根据 [GPLv3 许可证](https://www.gnu.org/licenses/gpl-3.0.txt) 的条款发布。它是一个健壮的 PE 文件解析器,具有灵活的插件架构,允许用户对文件进行深度静态分析。Manalyze... - 识别 PE 的编译器 - 检测加壳可执行文件 - 应用 ClamAV 签名 - 搜索可疑字符串 - 查找恶意导入组合(即 `WriteProcessMemory` + `CreateRemoteThread`) - 检测加密常量(类似于 IDA 的 findcrypt 插件) - 可向 VirusTotal 提交哈希值 - 验证 authenticode 签名(仅限 Windows) ## 如何构建 我讨厌的事情很少,但检出开源项目后花两个小时试图构建它是其中之一。这就是为什么我尽最大努力让 Manalyze 尽可能容易构建。如果这几行命令对您不起作用,那么我就没有做好我的工作,您应该给我留言,以便我修复它。 ### 在 Linux 和 BSD 上(已在 Debian Bullseye 和 FreeBSD 10.2 上测试) ``` $> [sudo or as root] apt-get install libboost-dev libboost-system-dev libssl-dev build-essential cmake git $> [alternatively, also sudo or as root] pkg install boost libressl cmake git $> git clone https://github.com/JusticeRage/Manalyze.git && cd Manalyze $> cmake . $> make -j5 $> cd bin && ./manalyze --version ``` 注意:VirusTotal 插件是可选的,并且需要 Boost.System 库。 最后,如果您想从机器上的任何目录访问 Manalyze,请从项目的根文件夹使用 `$> make install` 进行安装。 ### 在 Windows 上 - 从 [boost.org](http://boost.org) 获取 Boost(头文件)并安装 [CMake](http://www.cmake.org/download/)。 - 如果您想要 VirusTotal 插件,请构建 Boost.System 库: - `cd boost_1_XX_0 && ./bootstrap.bat && ./b2.exe --build-type=complete --with-system` - 添加一个包含 `boost_1_XX_0` 文件夹路径的环境变量 `BOOST_ROOT`。 - 下载并安装 [Git](https://git-scm.com/download/win) - `git clone https://github.com/JusticeRage/Manalyze.git && cd Manalyze && cmake .` - 一个名为 `manalyze.sln` 的 Visual Studio 项目应该已经出现在 `Manalyze` 文件夹中! ### 在 OS X 上(已在 Mojave 上测试) ``` # 如果已有正常的构建环境则跳过这两行 user$ xcode-select --install user$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / user$ git clone https://github.com/JusticeRage/Manalyze.git && cd Manalyze user$ brew install openssl boost user$ cmake . -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ && make -j5 user$ bin && ./manalyze --version ``` ### 离线构建 如果您需要在无法访问互联网的机器上构建 Manalyze,则必须手动检出以下项目: - [Yara](https://github.com/JusticeRage/yara/archive/master.zip) - [hash-library](https://github.com/JusticeRage/hash-library/archive/master.zip) 将这两个文件夹分别放入 `external` 文件夹中,即 `external/yara` 和 `external/hash-library`。然后运行 `cmake . -DGitHub=OFF` 并像往常一样继续。 ### 二进制文件 - [Windows x64 二进制文件](https://manalyzer.org/static/manalyze_x64.zip) ### Docker 镜像 社区提供了 Manalyze 的 Docker 镜像。运行 `docker pull evanowe/manalyze` 并在[此处](https://hub.docker.com/r/evanowe/manalyze)获取更多信息。 ## 生成 ClamAV 规则 由于 ClamAV 签名体积庞大且定期更新,因此从 GitHub 或二进制文件中分发它们没有太大意义。当您首次尝试使用 ClamAV 插件时,可能会遇到以下错误消息:`[!] Error: Could not load yara_rules/clamav.yara`。为了生成它们,请运行位于 `bin/yara_rules`(源码树)或 `${CMAKE_INSTALL_DATADIR}/manalyze/yara_rules`(已安装,通常是 `/usr/share/manalyze/yara_rules` 或 `/usr/local/share/manalyze/yara_rules`)中的 `update_clamav_signatures.py` Python 脚本。 每当您想刷新签名时运行该脚本。编译后的 Yara 缓存存储在 `$XDG_CACHE_HOME/manalyze/yara_rules` 或 `~/.cache/manalyze/yara_rules` 中,并且可以通过 `MANALYZE_CACHE_DIR` 进行覆盖。 ## 路径和覆盖 默认安装位置(遵循 `CMAKE_INSTALL_PREFIX`)是: - config: `${CMAKE_INSTALL_SYSCONFDIR}/manalyze/manalyze.conf` (通常是 `/etc/manalyze/manalyze.conf` 或 `/usr/local/etc/manalyze/manalyze.conf`) - rules: `${CMAKE_INSTALL_DATADIR}/manalyze/yara_rules` (通常是 `/usr/share/manalyze/yara_rules` 或 `/usr/local/share/manalyze/yara_rules`) - plugins: `${CMAKE_INSTALL_LIBDIR}/manalyze/plugins` 您可以使用环境变量覆盖这些设置: `MANALYZE_CONFIG_DIR`, `MANALYZE_DATA_DIR`, `MANALYZE_PLUGIN_DIR`, `MANALYZE_CACHE_DIR`。 ## 使用方法 ``` $ ./manalyze.exe --help Usage: -h [ --help ] Displays this message. -v [ --version ] Prints the program's version. --pe arg The PE to analyze. Also accepted as a positional argument. Multiple files may be specified. -r [ --recursive ] Scan all files in a directory (subdirectories will be ignored). -o [ --output ] arg The output format. May be 'raw' (default) or 'json'. -d [ --dump ] arg Dump PE information. Available choices are any combination of: all, summary, dos (dos header), pe (pe header), opt (pe optional header), sections, imports, exports, resources, version, debug, tls, config, delay, rich --hashes Calculate various hashes of the file (may slow down the analysis!) -x [ --extract ] arg Extract the PE resources to the target directory. -p [ --plugins ] arg Analyze the binary with additional plugins. (may slow down the analysis!) Available plugins: - clamav: Scans the binary with ClamAV virus definitions. - compilers: Tries to determine which compiler generated the binary. - peid: Returns the PEiD signature of the binary. - strings: Looks for suspicious strings (anti-VM, process names...). - findcrypt: Detects embedded cryptographic constants. - packer: Tries to structurally detect packer presence. ## Python bindings (manapy) Python bindings live under `manapy/` and are imported as `manalyze`. From the repository root: ``` cd manapy python -m pip install . ``` - imports: Looks for suspicious imports. - resources: Analyzes the program's resources. - mitigation: Displays the enabled exploit mitigation techniques (DEP, ASLR, etc.). - overlay: Analyzes data outside of the PE's boundaries. - authenticode: Checks if the digital signature of the PE is valid. - virustotal: Checks existing AV results on VirusTotal. - all: Run all the available plugins. Examples: manalyze.exe program.exe manalyze.exe -dresources -dexports -x out/ program.exe manalyze.exe --dump=imports,sections --hashes program.exe manalyze.exe -r malwares/ --plugins=peid,clamav --dump all ``` ## Manalyze 的使用者 - [ANY.RUN](https://any.run/) - [CinCan](https://cincan.io/) - [DFN-CERT](https://www.dfn-cert.de/) - [The Hive](https://blog.thehive-project.org/tag/manalyze/) - [Yomi](https://yomi.yoroi.company) - [Threat.Zone](https://threat.zone) 如果您想被添加到此列表中,请联系我或发起 pull request! ## 联系方式 [![电子邮箱](https://manalyzer.org/static/img/mail.png)](mailto:justicerage@manalyzer[.]org) [![Twitter](http://manalyzer.org/static/img/twitter.png)](https://twitter.com/JusticeRage) [![GnuPG](http://manalyzer.org/static/img/gpg.png)](https://pgp.mit.edu/pks/lookup?op=vindex&search=0x40E9F0A8F5EA8754)
标签:Ask搜索, Bash脚本, C++, ClamAV, DNS 反向解析, IP 地址批量处理, PE文件分析, VirusTotal, Web 安全测试, YARA, 二进制分析, 云安全监控, 云安全运维, 云资产可视化, 云资产清单, 可执行文件分析, 壳检测, 威胁情报, 安全测试工具, 开发者工具, 恶意代码分析, 数字签名验证, 数据擦除, 编译器识别, 网络信息收集, 网络安全, 网络安全审计, 请求拦截, 逆向工具, 逆向工程, 配置文件, 隐私保护, 静态分析