analyzing-supply-chain-malware-artifacts
调查供应链攻击工件,包括被木马化的软件更新、被攻陷的构建流水线和侧载的依赖项,以识别入侵向量和攻陷范围。
Best use case
analyzing-supply-chain-malware-artifacts is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
调查供应链攻击工件,包括被木马化的软件更新、被攻陷的构建流水线和侧载的依赖项,以识别入侵向量和攻陷范围。
Teams using analyzing-supply-chain-malware-artifacts should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/analyzing-supply-chain-malware-artifacts/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How analyzing-supply-chain-malware-artifacts Compares
| Feature / Agent | analyzing-supply-chain-malware-artifacts | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
调查供应链攻击工件,包括被木马化的软件更新、被攻陷的构建流水线和侧载的依赖项,以识别入侵向量和攻陷范围。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 分析供应链恶意软件工件
## 概述
供应链攻击通过破坏合法软件分发渠道,借助受信任的更新机制投递恶意软件。典型案例包括 SolarWinds SUNBURST(2020 年,影响 18,000 多个客户)、3CX SmoothOperator(2023 年,一起源自 Trading Technologies 的级联供应链攻击)以及大量 npm/PyPI 包投毒活动。分析工作涉及:将木马化二进制文件与合法版本进行比对、识别构建工件中的注入代码、检查代码签名异常,以及追踪从初始攻陷到载荷投递的感染链。截至 2025 年,供应链攻击占所有违规事件的 30%,较前几年增加了 100%。
## 前置条件
- Python 3.9+,安装 `pefile`、`ssdeep`、`hashlib`
- 二进制对比工具(BinDiff、Diaphora)
- 代码签名验证工具(sigcheck、codesign)
- 软件成分分析(SCA)工具
- 访问合法软件版本以供比对
- 包仓库监控(npm、PyPI、NuGet)
## 操作步骤
### 步骤 1:二进制比对分析
```python
#!/usr/bin/env python3
"""比对木马化二进制文件与合法版本。"""
import hashlib
import pefile
import sys
import json
def compare_pe_files(legitimate_path, suspect_path):
"""比对合法版本与可疑版本之间的 PE 文件结构。"""
legit_pe = pefile.PE(legitimate_path)
suspect_pe = pefile.PE(suspect_path)
report = {"differences": [], "suspicious_sections": [], "import_changes": []}
# 比对节
legit_sections = {s.Name.rstrip(b'\x00').decode(): {
"size": s.SizeOfRawData,
"entropy": s.get_entropy(),
"characteristics": s.Characteristics,
} for s in legit_pe.sections}
suspect_sections = {s.Name.rstrip(b'\x00').decode(): {
"size": s.SizeOfRawData,
"entropy": s.get_entropy(),
"characteristics": s.Characteristics,
} for s in suspect_pe.sections}
# 查找新增或已修改的节
for name, props in suspect_sections.items():
if name not in legit_sections:
report["suspicious_sections"].append({
"name": name, "reason": "合法版本中不存在的新节",
"size": props["size"], "entropy": round(props["entropy"], 2),
})
elif abs(props["size"] - legit_sections[name]["size"]) > 1024:
report["suspicious_sections"].append({
"name": name, "reason": "节大小发生显著变化",
"legit_size": legit_sections[name]["size"],
"suspect_size": props["size"],
})
# 比对导入
legit_imports = set()
if hasattr(legit_pe, 'DIRECTORY_ENTRY_IMPORT'):
for entry in legit_pe.DIRECTORY_ENTRY_IMPORT:
for imp in entry.imports:
if imp.name:
legit_imports.add(f"{entry.dll.decode()}!{imp.name.decode()}")
suspect_imports = set()
if hasattr(suspect_pe, 'DIRECTORY_ENTRY_IMPORT'):
for entry in suspect_pe.DIRECTORY_ENTRY_IMPORT:
for imp in entry.imports:
if imp.name:
suspect_imports.add(f"{entry.dll.decode()}!{imp.name.decode()}")
new_imports = suspect_imports - legit_imports
if new_imports:
report["import_changes"] = list(new_imports)
# 检查代码签名
report["legit_signed"] = bool(legit_pe.OPTIONAL_HEADER.DATA_DIRECTORY[4].Size)
report["suspect_signed"] = bool(suspect_pe.OPTIONAL_HEADER.DATA_DIRECTORY[4].Size)
return report
def hash_file(filepath):
"""计算文件的多种哈希值。"""
hashes = {}
with open(filepath, 'rb') as f:
data = f.read()
for algo in ['md5', 'sha1', 'sha256']:
h = hashlib.new(algo)
h.update(data)
hashes[algo] = h.hexdigest()
return hashes
if __name__ == "__main__":
if len(sys.argv) < 3:
print(f"用法:{sys.argv[0]} <legitimate_binary> <suspect_binary>")
sys.exit(1)
report = compare_pe_files(sys.argv[1], sys.argv[2])
print(json.dumps(report, indent=2, ensure_ascii=False))
```
## 验证标准
- 通过二进制对比识别出被木马化的组件
- 注入的代码被隔离并单独分析
- 代码签名异常已记录
- 从构建工件重建感染时间线
- 评估对受影响系统的下游影响范围
- 提取 IoC 用于检测和封锁
## 参考资料
- [ReversingLabs - 3CX 供应链分析](https://www.reversinglabs.com/blog/what-went-wrong-with-the-3cx-software-supply-chain-attack-and-how-it-could-have-been-prevented)
- [Fortinet - SolarWinds 供应链攻击](https://www.fortinet.com/resources/cyberglossary/solarwinds-cyber-attack)
- [Picus - 3CX SmoothOperator 分析](https://www.picussecurity.com/resource/blog/smoothoperator-analysis-of-3cxdesktopapp-supply-chain-attack)
- [MITRE ATT&CK T1195 - 供应链攻陷](https://attack.mitre.org/techniques/T1195/)Related Skills
reverse-engineering-rust-malware
使用 IDA Pro 和 Ghidra 对 Rust 编译的恶意软件进行逆向工程,掌握处理非空终止字符串、提取 crate 依赖项和 Rust 特有控制流分析的专项技术。
reverse-engineering-malware-with-ghidra
使用 NSA 的 Ghidra 反汇编器和反编译器对恶意软件二进制文件进行逆向工程,在汇编和伪 C 代码层面理解其内部逻辑、密码学例程、C2 协议和规避技术。适用于恶意软件逆向工程、反汇编分析、反编译、二进制分析或理解恶意软件内部机制等请求。
reverse-engineering-dotnet-malware-with-dnspy
使用 dnSpy 反编译器和调试器对 .NET 恶意软件进行逆向工程,分析 C#/VB.NET 源代码,识别混淆技术,提取配置信息,理解包括信息窃取器、远程访问木马(RAT)和加载器在内的恶意功能。适用于 .NET 恶意软件分析、C# 恶意软件反编译、托管代码逆向工程或 .NET 混淆分析等请求。
reverse-engineering-android-malware-with-jadx
使用 JADX 反编译器对恶意 Android APK 文件进行逆向工程,分析 Java/Kotlin 源代码,识别包括数据窃取、C2 通信、权限提升和覆盖攻击在内的恶意功能。检查 Manifest 权限、Receiver、Service 及原生库。适用于 Android 恶意软件分析、APK 逆向工程、移动端恶意软件调查或 Android 威胁分析等请求。
performing-supply-chain-attack-simulation
模拟和检测软件供应链攻击,包括通过 Levenshtein 距离检测域名抢注(Typosquatting)、针对私有注册表的依赖混淆(Dependency Confusion)测试、使用 pip 进行包哈希验证,以及使用 pip-audit 扫描已知漏洞。
performing-static-malware-analysis-with-pe-studio
使用 PEStudio 对 Windows PE(可移植可执行文件)恶意软件样本进行静态分析, 检查文件头、导入表、字符串、资源和指标,无需执行二进制文件。 识别可疑特征,包括加壳、反分析技术和恶意导入。适用于静态恶意软件分析、 PE 文件检查、Windows 可执行文件分析或执行前恶意软件分级等请求场景。
performing-malware-triage-with-yara
使用 YARA 规则对文件模式、字符串、字节序列和结构特征进行匹配,快速分级和分类恶意软件样本, 识别已知恶意软件家族及可疑指标。涵盖规则编写、扫描和与分析流程的集成。适用于 YARA 规则创建、 恶意软件分类、模式匹配、样本分级或基于签名的检测等请求场景。
performing-malware-persistence-investigation
系统性地调查 Windows 和 Linux 系统上的所有持久化机制,以识别恶意软件如何在重启后存活并维持访问。
performing-malware-ioc-extraction
恶意软件 IOC(失陷指标)提取是指通过分析恶意软件,识别可操作的失陷指标,包括文件哈希、网络指标(C2 域名、IP 地址、URL)、注册表修改、互斥体名称、嵌入字符串和行为产物。
performing-malware-hash-enrichment-with-virustotal
使用 VirusTotal API 富化恶意软件文件哈希,获取检测率、行为分析、YARA 匹配和上下文威胁情报,用于事件分类和 IOC 验证。
performing-firmware-malware-analysis
分析固件镜像中嵌入的恶意软件、后门和未授权修改,目标包括路由器、IoT 设备、UEFI/BIOS 和嵌入式系统。涵盖固件提取、文件系统分析、二进制逆向工程和 Bootkit 检测。适用于固件安全 分析、IoT 恶意软件调查、UEFI Rootkit 检测或嵌入式设备入侵评估等请求场景。
performing-automated-malware-analysis-with-cape
部署和操作 CAPEv2 沙箱,进行自动化恶意软件分析,具备行为监控、载荷提取、配置解析和反规避能力。