Communitygithub.com

分析惡意PDF(使用peepdf)

使用peepdf、pdfid等工具對可疑PDF文件進行靜態分析,協助檢測與提取嵌入式惡意內容。

分析惡意PDF(使用peepdf) 是什麼?

此技能專注於對惡意PDF文件進行靜態分析,特別適合用於處理釣魚郵件中的可疑附件、基於PDF的漏洞利用文件或嵌入式惡意軟體。支援的工具包括 peepdf-3(具備JavaScript模擬功能)、pdfid.py 和 pdf-parser.py(來自Didier Stevens套件),以及可選的PyV8與Pylibemu用於指令碼與shellcode分析。分析流程涵蓋從初步關鍵字掃描(如 /JS、/OpenAction、/Launch)、互動式物件探索、壓縮流解碼、JavaScript去混淆,到與VirusTotal交叉比對哈希值及生成威脅指標(IOCs)。最終產出的分析報告包含SHA-256哈希、可疑關鍵字、JavaScript物件ID、提取的URL、shellcode檢測結果、內嵌檔案統計以及VirusTotal檢測比率,並根據威脅程度給予關鍵/高/中/低風險等級。這套方法在隔離的虛擬機或沙箱環境中執行,確保安全分析的同時最大化威脅可見性。

相容平台~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 將檔案哈希與防毒偵測結果交叉比對。
  7. 生成威脅指標 (IOCs):提取 URL、域名、哈希值和 shellcode 特徵。

關鍵概念

概念描述
/OpenAction開啟 PDF 時自動執行的動作
/JavaScript /JS嵌入在 PDF 物件中的 JavaScript 程式碼
/Launch啟動外部應用程式的動作
/EmbeddedFile嵌入在 PDF 結構中的檔案
FlateDecode用於隱藏內容的 zlib 壓縮過濾器
物件串流以壓縮串流儲存的 PDF 物件

工具與系統

工具用途
peepdf / peepdf-3具備 JS 模擬功能的互動式 PDF 分析
pdfid.py快速初步掃描,尋找可疑關鍵字
pdf-parser.py深層物件級 PDF 解析
VirusTotal哈希查詢與防毒偵測交叉比對
CyberChef解碼與轉換提取的有效載荷

輸出格式

分析報告: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,

相關技能