XingLo SkillSearch

capa恶意能力识别与ATT&CK映射

用于使用Mandiant capa自动识别恶意二进制具备的能力,将匹配结果映射到MITRE ATT&CK与MBC,并指导理解规则命中和编写自定义capa规则。适合在静态分析早期快速获得样本能力概览,例如注入、网络、加密、持久化等,减少人工逐项查看导入函数和代码的工作量。

在 AI 中使用此 Skill将本页链接复制给 AI,即可让 AI 获取完整 Skill 内容并按此执行
安全提示: 本站 Skill 均经 ChatGPT 最新模型扫描,未发现恶意脚本及危险指令、未检出已知恶意行为特征,但不保证绝对安全,使用即表示接受此风险

Skill 文件

版本 20260301 · 79a886daa7bfde39e070c5ae1663bcc3

assets/
references/
scripts/
SKILL.md
---
name: capa-analysis
description: Use Mandiant's capa tool to automatically identify malware capabilities, map them to ATT&CK and MBC, interpret results, and write custom detection rules.
---

# Capa Analysis

Use Mandiant's capa to automatically identify capabilities in executable files. Capa matches binary behaviors against a library of rules and maps them to MITRE ATT&CK techniques and Malware Behavior Catalog (MBC) objectives.

## Prerequisites

- **capa**: Mandiant's capability detection tool (`pip install flare-capa` or download from GitHub releases)
- **Python 3.10+** for running the runner and rule writer scripts
- **capa rules**: Default rule set (bundled with capa) or custom rules directory

## Steps

### 1. Run Capa Against a Sample

Basic analysis:

```bash
capa sample.exe
```

For structured output, use the runner script which parses JSON and generates organized summaries:

```bash
python3 scripts/capa_runner.py --input sample.exe --output report.json
```

Options:
- `--format summary` (default), `json`, `csv`, or `markdown`
- `--group-by tactic` (default), `mbc`, `namespace`, or `capability`
- `--min-scope function` or `file` or `basic block`
- `--rules /path/to/custom/rules` for custom rule directories
- `--batch /path/to/samples/` to analyze multiple files

### 2. Interpret the Results

Capa output is organized by capability with mappings to:

- **ATT&CK Tactics and Techniques**: What the malware can do in ATT&CK terms
- **MBC Objectives and Behaviors**: Malware-specific behavior categories
- **Namespaces**: capa's own capability hierarchy (e.g., `persistence/registry`, `communication/http`)

Focus on:
- High-impact capabilities (data exfiltration, persistence, defense evasion)
- Unusual combinations that suggest specific malware families
- Capabilities that indicate the malware's stage (dropper, RAT, ransomware)

See `references/capa-guide.md` for detailed output interpretation.

### 3. Write Custom Rules

Generate a rule skeleton from a behavior description:

```bash
python3 scripts/capa_rule_writer.py --name "detect custom packer" \
    --description "Detects the custom UPX-variant packer used by APT-X" \
    --attack T1027.002 \
    --output custom_rules/detect_custom_packer.yml
```

Edit the generated YAML to add specific features (API calls, strings, byte patterns). Use `assets/capa-rule-template.yml` as a reference.

### 4. Test Custom Rules

```bash
capa --rules /path/to/custom_rules/ sample.exe
```

Validate that rules match expected samples and don't produce false positives.

### 5. Batch Analysis

Analyze an entire directory of samples:

```bash
python3 scripts/capa_runner.py --batch /path/to/samples/ --output batch_results/ --format csv
```

This generates per-sample reports and a combined summary.

## References

- `references/capa-guide.md` — Capa usage guide with installation, options, and output interpretation
- `references/capability-categories.md` — Capability categories reference
- `assets/capa-rule-template.yml` — Template capa rule for custom rule development