一款快速的 CLI 工具,用于 Windows PE 初步排查、滑动窗口熵分析,以及检测加载器和加密器中的隐藏载荷。
___________ __ _________ __ .__
\_ _____/ _____/ |________ ____ ______ ___.__./ _____// |________|__|_____
| __)_ / \ __\_ __ \/ _ \\____ < | |\_____ \\ __\_ __ \ \____ \
| \ | \ | | | \( <_> ) |_> >___ |/ \| | | | \/ | |_> >
/_______ /___| /__| |__| \____/| __// ____/_______ /|__| |__| |__| __/
\/ \/ |__| \/ \/ |__|
大多数快速分类工具会计算整个 PE 节区或整个文件的香农熵。攻击者在现代加载器中利用这种平均效应:
.rdata 节区中,可使整个节区的熵保持在 5.5 以下。0x90)或重复分隔符交错排列,可将分数拉低到良性代码水平。UuidFromStringA)或 IPv4 地址(RtlIpv4StringToAddressA),可使磁盘熵保持在 4.0 左右,直到运行时重新组装。EntropyStrip 通过子节区分析和结构检查来应对这些盲点。
UuidFromString 和 RtlIpv4StringToAddress 暂存原语以及格式化 UUID 字符串的簇。--yara [PATH] 指定的自定义规则。包含纯 Python 回退扫描器,可实现零依赖执行。RT_RCDATA 载荷。--bazaar 选择加入哈希信誉查询,以分类恶意软件家族、社区标签和 VirusTotal 检测率,默认不会泄露取证遥测数据。WIN_CERTIFICATE 目录边界和 NSIS 0xdeadbeef 头,以免对已签名软件和安装程序产生误报评分。--dump 将可疑缓冲区直接提取到磁盘,供 Ghidra 或 x64dbg 使用。需要 Windows、Linux 或 macOS 上的 Python 3.8+。
pip install entropystrip
或从源码安装:
git clone https://github.com/dwexi/entropystrip.git
cd entropystrip
pip install -e .
usage: entropystrip [-h] [-v] [-r] [--dump] [--deep] [-i] [--install]
[--uninstall] [--html HTML] [--json JSON]
[--yara [RULE_PATH]] [--bazaar] [--bazaar-key KEY]
[target]
EntropyStrip: PE De-obfuscator, Shannon Entropy Radar, and Incident Triage Engine
positional arguments:
target Path to Windows executable (.exe / .dll) or directory
options:
-h, --help show this help message and exit
-v, --version Show program's version number and exit
-r, --recursive Recursively scan subdirectories
--dump Carve high-entropy payloads to extracted_payloads/
--deep Deep forensic triage: MITRE ATT&CK mapping, entry point disassembly, hashes
-i, --interactive Launch interactive triage wizard
--install Install EntropyStrip globally to Windows PATH
--uninstall Uninstall EntropyStrip from Windows PATH
--html HTML Path to write standalone HTML report
--json JSON Path to write machine-readable JSON telemetry
--yara [RULE_PATH] Scan with YARA rules (uses bundled threats.yar by default, or custom file/dir)
--bazaar Query MalwareBazaar (abuse.ch) for sample hash intelligence and signatures
--bazaar-key KEY MalwareBazaar API Auth-Key (overrides MALWAREBAZAAR_API_KEY environment variable)
使用 YARA 扫描分析单个二进制文件:
entropystrip target.exe --yara
使用自定义 YARA 规则扫描并查询 MalwareBazaar 威胁情报:
entropystrip suspicious.exe --yara my_rules.yar --bazaar
基于 MITRE ATT&CK 映射与反汇编的深度取证分诊:
entropystrip suspicious.exe --deep
提取隐藏的载荷缓冲区和嵌入资源:
entropystrip suspicious.exe --dump
提取出的载荷会写入 extracted_payloads/payload_<sha256>_sec<index>_<section>.bin。
导出独立的 HTML 报告:
entropystrip sample.exe --html report.html
通过自动化活动聚类对整个目录进行分诊:
entropystrip "C:\IncidentTriage" -r --html incident_report.html
香农熵衡量信息密度,范围为每字节 0.00 至 8.00 比特:
| 熵范围 | 典型内容 | 说明 |
|---|---|---|
0.00 - 2.00 | 零填充、稀疏表 | 对齐填充、未初始化缓冲区 |
2.00 - 5.50 | 标准 ASCII、配置文件 | 应用程序元数据、可读字符串 |
5.50 - 6.60 | 原生编译机器码 | 标准 x86/x64 指令(.text) |
6.60 - 7.30 | 压缩资源 | 位图、图标、zlib/deflate 流 |
7.40 - 8.00 | 加密密文 | 加密载荷或打包的 shellcode |
MIT 许可证。详情请参阅 LICENSE。