Communitygithub.com

使用peepdf分析恶意PDF

使用peepdf、pdfid等工具对恶意PDF文档执行静态分析。

使用peepdf分析恶意PDF 是什么?

该技能适用于通过 peepdf、pdfid 和 pdf-parser 等工具对可疑 PDF 文档进行静态分析,特别针对钓鱼邮件附件中的武器化文档。其核心工作流包括:使用 pdfid 快速扫描 PDF 中的可疑关键字(如 /JS、/OpenAction、/Launch 等),然后在 peepdf 交互式模式下深入分析对象结构、提取嵌入式 JavaScript、shellcode 或可执行文件,并利用 VirusTotal 进行哈希交叉验证。支持的平台包括 Python 3.8+ 环境,可选 PyV8 和 Pylibemu 用于 JavaScript 模拟和 shellcode 分析。输出格式为标准化的分析报告,包含哈希值、可疑关键字列表、提取的 URL、检测到的 shellcode 以及风险等级评估。对于安全分析师和事件响应人员,该技能提供了一套完整的自动化恶意 PDF 分析流程。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-malicious-pdf-with-peepdf

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

使用peepdf分析恶意PDF 是做什么的?

何时使用

  • 对来自钓鱼邮件的可疑PDF附件进行初步分类时
  • 在对基于PDF的漏洞文档进行恶意软件分析时
  • 需要从PDF中提取嵌入式JavaScript、shellcode或可执行文件时
  • 对武器化文档工件进行取证检查时
  • 为基于PDF的威胁构建检测签名时

前提条件

  • Python 3.8+ 并安装 peepdf-3(pip install peepdf-3)
  • Didier Stevens 套件中的 pdfid.py 和 pdf-parser.py
  • 隔离的分析环境(虚拟机或沙箱)
  • 可选:PyV8 用于 peepdf 内的 JavaScript 仿真
  • 可选:Pylibemu 用于 shellcode 分析

工作流程

  1. 使用pdfid进行初步分类:扫描PDF中的可疑关键字(/JS、/JavaScript、/OpenAction、/Launch、/EmbeddedFile)。
  2. 交互式分析:在 peepdf 交互模式下打开PDF,探索对象结构。
  3. 识别可疑对象:定位包含JavaScript、流或编码数据的对象。
  4. 提取内容:转储可疑流并解码过滤器(FlateDecode、ASCIIHexDecode)。
  5. 反混淆JavaScript:分析提取的JS代码,查找shellcode、堆喷射或漏洞利用代码。
  6. 检查VirusTotal:使用 peepdf 的 vtcheck 功能,将文件哈希与AV检测结果进行交叉引用。
  7. 生成IOC:提取URL、域名、哈希值和shellcode签名。

关键概念

概念描述
/OpenAction打开PDF时自动执行的操作
/JavaScript /JSPDF对象中嵌入的JavaScript代码
/Launch启动外部应用程序的操作
/EmbeddedFile嵌入在PDF结构中的文件
FlateDecode用于隐藏内容的zlib压缩过滤器
对象流以压缩流形式存储的PDF对象

工具与系统

工具用途
peepdf / peepdf-3支持JS仿真的交互式PDF分析
pdfid.py快速扫描可疑关键字的初步分类
pdf-parser.py深度对象级PDF解析
VirusTotal哈希查找与AV检测交叉引用
CyberChef解码和转换提取的载荷

输出格式

Analysis Report: PDF-MAL-[日期]-[序号]
文件: [文件名.pdf]
SHA-256: [哈希值]
可疑关键字: [/JS, /OpenAction, 等]
含有JavaScript的对象: [对象ID]
提取的URL: [列表]
检测到Shellcode: [是/否]
嵌入式文件: [数量和类型]
VirusTotal检测结果: [X/Y个引擎]
风险等级: [严重/高/中/低]

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相关技能