Skip to content
Agentmart
Submit a tool

analyzing-macro-malware-in-office-documents

分析嵌入在 Microsoft Office 文档(Word、Excel、PowerPoint)中的恶意 VBA 宏, 识别下载摇篮、载荷执行、持久化机制和反分析技术。 使用 olevba、oledump 和 VBA 去混淆提取攻击链。 适用于 Office 宏分析、VBA…

Skill by killvxk

IndexedApache-2.0★ 57
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/killvxk-analyzing-macro-malware-in-office-documents

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

分析嵌入在 Microsoft Office 文档(Word、Excel、PowerPoint)中的恶意 VBA 宏, 识别下载摇篮、载荷执行、持久化机制和反分析技术。 使用 olevba、oledump 和 VBA 去混淆提取攻击链。 适用于 Office 宏分析、VBA 恶意软件调查、恶意文档分析或基于文档的威胁检查相关请求。

Use cases: documents, spreadsheets, presentations

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/analyzing-macro-malware-in-office-documents

What's inside

Skill name
analyzing-macro-malware-in-office-documents
Description
分析嵌入在 Microsoft Office 文档(Word、Excel、PowerPoint)中的恶意 VBA 宏, 识别下载摇篮、载荷执行、持久化机制和反分析技术。 使用 olevba、oledump 和 VBA 去混淆提取攻击链。 适用于 Office 宏分析、VBA 恶意软件调查、恶意文档分析或基于文档的威胁检查相关请求。
License
Apache-2.0
Instructions
306 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (4)

  • LICENSE
  • SKILL.md
  • api-reference.md · references/
  • agent.py · scripts/

SKILL.md (first lines)

# 分析 Office 文档中的宏恶意软件

## 适用场景

- 一个可疑的 Office 文档(.doc、.docm、.xls、.xlsm、.ppt)被电子邮件安全系统标记
- 调查投递武器化 Office 文档的钓鱼攻击活动
- 提取 VBA 宏代码以识别载荷下载 URL 和执行方法
- 分析混淆的 VBA 代码以了解完整的攻击链
- 确定文档是否使用 DDE、ActiveX 或远程模板注入而非宏

**不适用于**分析非宏 Office 威胁(DDE、远程模板注入);虽然本技能涵盖这些检测,但可能需要专门分析。

## 前置条件

- Python 3.8+,安装 oletools(`pip install oletools`)
- Didier Stevens 的 oledump.py
- 未安装 Microsoft Office 的隔离分析虚拟机(防止意外执行)
- XLMDeobfuscator 用于 Excel 4.0 宏分析(pip install xlmdeobfuscator)
- LibreOffice 用于安全文档渲染(默认不执行 VBA 宏)

## 工作流程

### 步骤 1:文档初始分类

确定文档是否包含宏或其他活动内容:

```bash
# 使用 olevba 快速分类
olevba suspect.docm

# 检查 OLE 流和宏
oleid suspect.docm

# 输出指标:
# VBA 宏:        True/False
# XLM 宏:        True/False
# 外部关系:      True/False(远程模板)
# ObjectPool:    True/False(嵌入对象)
# Flash:         True/False(SWF 对象)

# 综合 OLE 分析
oledump.py suspect.docm

# 列出所有带宏指示符的 OLE 流
# 标记为 'M' 的流包含 VBA 宏
# 标记为 'm' 的流包含宏属性
```

### 步骤 2:提取和分析 VBA 代码

提取完整的 VBA 宏源代码:

```bash
# 使用完整去混淆提取 VBA
olevba --decode --deobf suspect.docm

# 仅提取 VBA 源代码
olevba --code suspect.docm > extracted_vba.txt

# 使用 oledump 详细提取
oledump.py -s 8 -v suspect.docm  # 流 8(根据流列表调整)

# 提取所有宏流
oledump.py -p plugin_vba_dco suspect.docm
```

```
需要识别的关键 VBA 元素:
━━━━━━━━━━━━━━━━━━━━━━━━━━━
自动执行触发器:
  - Auto_Open / AutoOpen(Word)
  - Auto_Close / AutoClose
  - Document_Open / Document_Close
  - Workbook_Open(Excel)
  - AutoExec

可疑函数:
  - Shell() / Shell.Application
  - WScript.Shell.Run / Exec
  - CreateObject("WScript.Shell")
  - PowerShell 执行
  - URLDownloadToFile
  - MSXML2.XMLHTTP(HTTP 请求)
  - ADODB.Stream(文件写入)
  - Environ()(环境变量)
  - CallByName(间接方法调用)
```

### 步骤 3:VBA 代码去混淆

去除混淆层以揭示载荷:

```python
# VBA 去混淆技术
import re

def deobfuscate_vba(code):
    # 1. 解析 Chr() 调用:Chr(104) & Chr(116) -> "ht"
    def resolve_chr(match):
        try:
            return chr(int(match.group(1)))
        except:
            return match.group(0)
    code = re.sub(r'Chr\$?\((\d+)\)', resolve_chr, code)

    # 2. 去除字符串拼接:"htt" & "p://" -> "http://"
    code = re.sub(r'"\s*&\s*"', '', code)

    # 3. 解析 ChrW 调用:ChrW(104)
    code = re.sub(r'ChrW\$?\((\d+)\)', resolve_chr, code)

    # 4. 解析 StrReverse:StrReverse("exe.daolnwod") -> "download.exe"
    def resolve_reverse(match):
        return '"' + match.group(1)[::-1] + '"'
    code = re.sub(r'StrReverse\("([^"]+)"\)', resolve_reverse, code)

    # 5. 去除 Mid$/Left$/Right$ 混淆(复杂,标记为需要手动审查)

    # 6. 解析 Replace():Replace("Powxershxell", "x", "")

From killvxk/cybersecurity-skills-zh, Apache-2.0.

More from killvxk/cybersecurity-skills-zh

Signals

Stars
57
Forks
14
Open issues
1
Last commit (this folder)
Mar 17, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from killvxk

Cite this page

analyzing-macro-malware-in-office-documents skill. Agent Mart. https://agentmart.dev/skills/killvxk-analyzing-macro-malware-in-office-documents (last updated 2026-10-24)