Back to skill

Security audit

PDF Translate

Security checks for vulnerabilities and agentic risk

Overview

This PDF translation skill is mostly purpose-aligned, but its PDF rendering path can unexpectedly load external or local resources from untrusted Markdown and one bundled legacy script writes to a hardcoded personal path.

Review before installing. Use it only for documents you are comfortable processing locally, confirm that Chinese is the desired target language, avoid rendering untrusted Markdown unless network and local-file fetching are sandboxed or disabled, and do not run the legacy generate_complete_pdf.py helper without changing its hardcoded output path.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/md2pdf.py:263
Finding

Unrestricted External Resource Loading During Markdown-to-PDF Conversion

Content
View full analysis
None: with open(md_path, "r", encoding="utf-8") as f: md_text = f.read() extensions = [ "extra", # tables, fenced_code, footnotes, etc. "codehilite", # syntax highlighting hints "toc", # table of contents "sane_lists", # better list handling "smarty", # smart quotes ] extension_configs = { "codehilite": { "css_class": "highlight", "guess_lang": False, }, } html_body = markdown.markdown( md_text, extensions=extensions, extension_configs=extension_configs, output_format="html5", ) full_html = f""" {CSS_STYLESHEET} {html_body} """ HTML(string=full_html).write_pdf(pdf_path) ``` ### Technical Analysis The converter reads the entire input Markdown file, converts it to HTML, and passes the generated document directly to WeasyPrint without sanitizing embedded HTML or restricting resource URLs. Python-Markdown permits raw HTML in Markdown by default. Consequently, attacker-controlled Markdown can contain resource-loading elements such as images or other HTML constructs referencing absolute URLs. WeasyPrint may resolve these resources while rendering the PDF. This creates a server-side request forgery and privacy-leak surface. Requests originate from the machine running the Skill rather than from the attacker, potentially giving them access to network locations not directly reachable from their own system. The code does not define a custom WeasyPrint `url_fetcher`, enforce an allowed protocol list, ...[truncated 1259 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/translate_pdf.py:168
Finding

Untrusted PDF Text Is Interpreted as ReportLab Paragraph Markup

Content
View full analysis
{english_text}' if len(english_text.split()) > 2 or len(english_text) > 10: return f'{english_text}' return english_text result = re.sub(english_pattern, replace_english, text) return result ``` ### Technical Analysis `pdfplumber` extracts text from an untrusted input PDF, after which the text is supplied to ReportLab's `Paragraph` parser without escaping markup-sensitive characters such as `<`, `>`, and `&`. ReportLab `Paragraph` objects interpret a supported XML ...[truncated 1832 chars]
Remediation
View remediation
`. 2. Separate untrusted text from trusted formatting. Escape the source first, then add only application-generated formatting tags. 3. Prefer ReportLab APIs that construct styled fragments without parsing user-controlled markup. 4. If markup support is necessary, implement a strict allowlist of accepted tags and attributes. 5. Explicitly reject image, link, callback, or resource-loading constructs in untrusted content. 6. Apply input-size, page-count, paragraph-length, and rendering-time limits. 7. Execute document conversion in a sandbox with no network access and minimal filesystem permissions. 8. Add regression tests using malformed tags, nested tags, entity sequences, oversized attributes, and resource-bearing markup. ]]>

T08 · Insecure Dependencies

Note
Location
requirements.txt:4
Finding

Dependencies Are Installed Without Exact Version and Integrity Pinning

Content
View full analysis
=0.10.0 # Core: Markdown → PDF (v4.0 recommended engine) markdown>=3.5.0 weasyprint>=60.0 # Legacy: PDF generation (v3.0 and earlier) reportlab>=4.0.0 pypdf>=3.0.0 ``` The Skill instructions also recommend unconstrained direct installation: ```bash brew install pango pip3 install pdfplumber markdown weasyprint # Legacy dependencies pip3 install reportlab pypdf ``` ### Technical Analysis The requirements use lower-bound constraints rather than exact reviewed versions, while the documented `pip3 install` commands impose no version constraints at all. As a result, two installations performed at different times can receive different package versions and dependency trees. No typosquatted package name, alternate package index, or known malicious source was identified in the reviewed project. The risk arises from allowing future, unreviewed package releases to be selected automatically. A compromised upstream release, newly introduced vulnerability, or incompatible dependency update could therefore affect the Skill without any repository change. The absence of package hashes also means the installer does not verify that downloaded artifacts match a repository-reviewed set of distributions. ### Attack Path 1. A user follows the installation instructions or installs from `requirements.txt`. 2. The package manager resolves the newest versions satisfying the lower-bound constraints. 3. A compromised, vulnerable, or behaviorally incompatible future release is selected. 4. Package installation code or imported runtime code executes with the privileges of the user running the Skill. 5. The affected dependency can access the same files, network, and process environm ...[truncated 496 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (38)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description suggests a general-purpose PDF translation pipeline: accept a PDF, extract its text, translate it into Chinese section by section, convert to structured Markdown, and render a final PDF with weasyprint. The supplied code chunk does something materially narrower and different: it contains a prewritten Chinese document in a constant, parses simple Markdown-like headings from that constant, and renders a styled PDF with reportlab to a hardcoded filesystem location. There is no code for opening or reading a source PDF, no OCR or text extraction, no translation engine or API calls, no section-by-section translation flow, and no weasyprint usage. While the output is indeed a Chinese PDF with typography considerations, that is only one downstream formatting aspect of the declared skill and not enough to match the claimed primary purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The code chunk is a standalone Markdown-to-PDF renderer. It accepts input.md and output.pdf, reads Markdown text, converts it to HTML, applies a large CSS stylesheet with CJK-capable fonts, and writes a PDF via WeasyPrint. This aligns only with the final formatting/rendering portion of the declared description. The declared purpose claims a broader translation workflow beginning from PDF documents and including text extraction and translation into Chinese; none of those behaviors appear in this code. Therefore the description materially overstates and misrepresents the actual behavior of the supplied code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description materially overstates and misrepresents the code's behavior. The script does extract text from PDFs and generate a PDF output with some CJK font support, which partially aligns with the typography/PDF-generation aspect. However, the core promised capability—translation to Chinese—is absent: the translation function is a no-op and main() never calls any translation step. The description also says it translates section-by-section into well-structured Markdown and then renders via weasyprint, but the code neither creates Markdown nor imports/uses weasyprint. Instead, it uses reportlab to rebuild extracted text into a styled PDF with page labels. This is a significant description-behavior mismatch in primary purpose and implemented capabilities.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill manifest describes a workflow that extracts text from a PDF, translates it section-by-section into Markdown, and then generates a Chinese PDF. This file instead embeds a fixed Chinese translation in a string constant and later renders it directly to PDF, with no PDF input handling, text extraction, or translation logic.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module documentation claims it generates a PDF with translated content, but the implementation writes the original content unchanged. This documentation/behavior mismatch is dangerous in a skill context because the agent may advertise a security- or compliance-relevant transformation that never happened, undermining trust and potentially causing users to distribute untranslated sensitive material.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script is presented as translating PDFs, but it does not perform any translation and instead republishes the extracted original text. In an agent setting, this can mislead users and downstream automation into believing a translated artifact was produced, causing integrity failures, bad decisions, or inadvertent disclosure when users share an output they assume has been transformed or reviewed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README describes the skill as translating English PDFs into Chinese documents, and the usage/workflow sections consistently frame output as Chinese only. The policy allows locale or language constraints when the user is given a choice or the limitation is clearly justified as region-specific; neither is stated here.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 18)May include surrounding context.

md
- **Professional typography** — Dark code blocks, alternating-row tables, blue-bordered blockquotes, hierarchical headings
- **Full CJK support** — PingFang SC / STHeiti / Microsoft YaHei / Noto Sans CJK fallback chain; Chinese renders correctly everywhere, including code blocks
- **Dual output** — Produces both `.md` and `.pdf` so you get an editable source and a polished document
- **Academic-quality translation** — Three-step workflow (rewrite → diagnose → polish) that eliminates "translationese"
- **Cross-platform** — macOS, Windows, and Linux with automatic font detection

## Quick Start

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

SQP-3 适用于所有文件。L003 明确写明该 skill 是“英译中 Skill,输出排版精美的中文文档”,整体文档后续也持续描述为固定翻译为中文,未见用户可选择目标语言或明确的语言/locale opt-in 机制,这构成强制语言/locale 的自然语言策略问题。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill instructs reading input PDFs, referencing environment-dependent paths like ${SKILL_DIR}, and writing derived files, but it declares no explicit tool scope or permissions. That creates ambiguity about what filesystem and environment access the skill expects, increasing the risk of over-broad execution in agent frameworks that rely on manifest-declared constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The invocation guidance includes broad phrases like 'translate this document' and 'pdf translate', which can cause the skill to activate in contexts where the user did not specifically consent to this workflow. Over-broad activation is risky here because the skill reads documents and writes output files, so accidental triggering could expose sensitive content to unnecessary processing or cause unintended filesystem changes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The version history states that output should be fully aligned with Chinese academic expression and read like original Chinese prose. Because this is natural-language guidance in a markdown file and no user language choice or region-specific justification is provided here, it constitutes a locale/language policy concern.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest says this skill translates PDF documents to Chinese, extracting text and translating section-by-section before generating a PDF. This file instead presents a complete workflow for generating a formatted PDF from already-written Markdown content, with no PDF parsing or translation behavior shown, creating a semantic mismatch between the skill's claimed purpose and the documented implementation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file contains user-facing instructional content exclusively in Chinese, from the title through the usage guidance. Under the policy for natural-language violations, forcing a specific language without user opt-in is a reportable locale-policy issue unless the regional constraint is clearly justified, which is not stated here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The title and opening description present the skill guidance entirely in Chinese and specify Chinese-English mixed typography rules as the default behavior. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy violation unless the regional constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill hard-codes Chinese as the only output language and frames the task as producing publication-quality Chinese without indicating that this behavior depends on user preference. In a translation skill, overriding or assuming the target language can cause unintended disclosure, incorrect task fulfillment, or user confusion when the user expects another language or wants confirmation before translation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire troubleshooting guide is written in Chinese, with no indication that users can choose another language or that the locale restriction is intentional and documented as region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · README.md (reported line 31)May include surrounding context.

md
# System dependencies (not pip-installable):
# macOS:  brew install pango
# Linux:  sudo apt install libpango1.0-dev

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · README_CN.md (reported line 31)May include surrounding context.

md
# System dependencies (not pip-installable):
# macOS:  brew install pango
# Linux:  sudo apt install libpango1.0-dev

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · requirements.txt (reported line 20)May include surrounding context.

text
# System dependencies (not pip-installable):
# macOS:  brew install pango
# Linux:  sudo apt install libpango1.0-dev

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring states the script generates a complete translated PDF, and the embedded content plus output filename indicate the result is specifically a Chinese version. There is no natural-language indication that language is configurable, optional, or justified as a region-specific tool, which conflicts with the policy against forcing a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest specifically claims PDF generation via WeasyPrint with professional typography and full CJK support. This file imports and uses ReportLab to build the PDF and contains no WeasyPrint usage, indicating a material mismatch between the documented implementation and actual behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script writes output to a hardcoded absolute path in a specific user's home directory. In an agent context, hardcoded filesystem writes can cause unintended overwrites, information disclosure about the runtime environment, or failures that push operators to run with broader permissions than necessary.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes a skill that extracts text from PDFs, translates content section-by-section into Chinese Markdown, and then generates a PDF. In this file, the implemented behavior is limited to reading a Markdown file, rendering it to HTML, and writing a PDF; there is no PDF input handling or translation functionality.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The generated document sets <html lang="zh-CN"> unconditionally, which forces a specific language/locale regardless of the input document or user preference. The file header also emphasizes Chinese typography, but there is no opt-in, parameter, or documented region-specific justification for always using the Chinese locale.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.