Back to skill

Security audit

Markdown to PDF (CJK)

Security checks for vulnerabilities and agentic risk

Overview

This Markdown-to-PDF skill is coherent, but its recipe renders unescaped Markdown through WeasyPrint, which is risky for untrusted files.

Review this skill before installing if you will convert Markdown from other people or untrusted sources. It should be safer if it disables raw HTML, sanitizes generated HTML and CSS, blocks file and network resource loading in WeasyPrint, and uses explicit output paths.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:46
Finding

Untrusted Markdown Is Rendered as Active HTML, Enabling SSRF and Local Resource Disclosure

Content
View full analysis
\1', html, flags=re.MULTILINE) html = re.sub(r'^## (.+)$', r'

\1

', html, flags=re.MULTILINE) html = re.sub(r'^### (.+)$', r'

\1

', html, flags=re.MULTILINE) html = re.sub(r'\*\*(.+?)\*\*', r'\1', html) html = re.sub(r'\*(.+?)\*', r'\1', html) html = re.sub(r'^> (.+)$', r'
\1
', html, flags=re.MULTILINE) html = re.sub(r'^---$', r'
', html, flags=re.MULTILINE) html = re.sub(r'^- (.+)$', r'
  • \1
  • ', html, flags=re.MULTILINE) html = re.sub(r'`([^`]+)`', r'\1', html) html = re.sub(r'```(\w*)\n(.*?)```', r'
    text
    \2
    ', html, flags=re.DOTALL) # Paragraphs html = re.sub(r'\n\n', r'

    ', html) html = '

    ' + html + '

    ' ``` The resulting HTML is then processed by WeasyPrint: ```bash weasyprint /tmp/input.html /tmp/output.pdf ``` ### Technical Analysis The assignment `html = md_content` treats attacker-controlled Markdown as trusted HTML. The subsequent regular-expression replacements add formatting but do not HTML-escape the source or apply an allowlist sanitizer. Consequently, raw elements such as ``, ``, ``, and attachment links, as well as CSS constructs such as `@import` and `url(...)`, can remain in the generated document. WeasyPrint is a server-side HTML renderer capable of retrieving resources referenced by HTML and CSS. Rendering hostile input can therefore make the host access attacker-selected HTTP endpoints, internal services, metadata endpoints, or accessible local ...[truncated 2676 chars]
    Remediation
    View remediation
    Vulnerability Patterns
    • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
    • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
    • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
    • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
    • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
    Findings (4)

    YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

    High
    Category
    YARA Match
    Confidence
    80% confidence
    Finding

    YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

    Content

    Scanner excerpt · SKILL.md (reported line 3)May include surrounding context.

    md
    ---
    name: md2pdf-cjk
    description: "Markdown to PDF converter with CJK (Chinese/Japanese/Korean) support. Uses WeasyPrint + Noto CJK fonts for proper rendering. Features: emoji replacement, custom CSS styling, code blocks, tables. Triggers: generate PDF, convert PDF, markdown to PDF, md2pdf."
    ---
    
    # Markdown to PDF (CJK)
    
    Convert Markdown files to well-formatted PDF with full CJK (Chinese/Japanese/Korean) support, code blocks, and tables.
    
    ## Toolchain
    
    - **Rendering engine**: WeasyPrint (pre-installed, `/usr/local/bin/weasyprint`)
    - **Fonts**: Noto Sans CJK SC / Noto Serif CJK SC (system-installed)
    - **Pipeline**:
    

    Vague Triggers

    Medium
    Category
    Not specified by scanner
    Confidence
    90% confidence
    Finding

    The manifest description lists triggers like "generate PDF" and especially "convert PDF," which are ambiguous and broad enough to match common everyday requests outside this skill's intended markdown-to-PDF scope. The file does not provide constraints or negative examples clarifying that invocation is only for markdown-to-PDF conversion.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Low
    Category
    Not specified by scanner
    Confidence
    82% confidence
    Finding

    The HTML template hard-codes CJK SC fonts, which biases rendering toward Simplified Chinese locale choices without offering the user a language or font-selection option. For a tool advertised as supporting Chinese, Japanese, and Korean, forcing one locale-specific font set may violate language/locale flexibility expectations.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Low
    Category
    Not specified by scanner
    Confidence
    78% confidence
    Finding

    The markdown describes generating a PDF and specifies fixed output locations under /tmp, which affects user data and filesystem state, but it does not clearly warn the user that the skill will create output files on disk. The notes mention the output path operationally, but not as a user-facing caution about file creation or overwrite implications.

    Content

    No source excerpt is available for this finding.