Back to skill

Security audit

Md2pdf WeasyPrint

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a legitimate Markdown-to-PDF converter, but it can automatically install unpinned software and render untrusted Markdown in ways that may access local or network resources.

Review before installing. Use this only in a disposable or controlled environment, preinstall reviewed and pinned dependencies yourself, avoid running the wrapper with elevated privileges, and do not convert Markdown from untrusted sources unless network and filesystem access are sandboxed.

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 (2)

T08 · Insecure Dependencies

Warning
Location
scripts/convert-weasyprint.sh:31
Finding

Runtime Installation of Unpinned Python Dependencies

Content
View full analysis
/dev/null; then echo "⚠️ Python 依赖未安装,正在安装..." python3 -m pip install -q markdown weasyprint fi ``` ### Technical Analysis The conversion wrapper automatically installs `markdown` and `weasyprint` by package name when they are unavailable. No version constraints, integrity hashes, lockfile, isolated virtual environment, or explicitly approved package repository are used. Consequently, the code installed during a conversion is determined by the mutable state of the configured Python package index. The behavior can change after the Skill has been reviewed. Installation may also modify the invoking user's global Python environment. This pattern does not prove that the current packages are malicious, but it creates a supply-chain attack surface. A compromised upstream release, package index, mirror, DNS path, or local `pip` configuration could supply attacker-controlled package code. Python packages can execute code during installation, and the wrapper subsequently imports the installed modules. ### Attack Path 1. The attacker compromises an upstream dependency release, configured package mirror, or package-resolution path. 2. A user runs `scripts/convert-weasyprint.sh` in an environment where either dependency is missing. 3. The dependency check fails and invokes: ```bash python3 -m pip install -q markdown weasyprint ``` 4. `pip` downloads the currently resolved, unverified package artifacts. 5. Attacker-controlled installation or package code executes with the permissions of the user running the wrapper. 6. The malicious package may retain access whenever it is imported in later conversions. ### Impact Assessment Successful exploitation per ...[truncated 685 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/convert-weasyprint.py:34
Finding

Untrusted Markdown Can Trigger Local or Network Resource Fetching During PDF Rendering

Content
View full analysis
{html_content} """ ``` WeasyPrint then renders that HTML without a restrictive custom URL fetcher: ```python HTML(string=full_html).write_pdf(str(output_path)) ``` ### Technical Analysis Markdown image syntax and embedded raw HTML can introduce resource-bearing elements such as images. The generated HTML is passed directly to WeasyPrint, whose rendering process can resolve supported resource URLs. The implementation does not: - Sanitize raw HTML from the Markdown input. - Restrict allowed URL schemes. - Restrict resources to an approved local asset directory. - Block loopback, link-local, or private-network destinations. - Block explicit local-file URLs. - Apply resource download size or timeout controls through a custom fetcher. An attacker-controlled Markdown document can therefore cause the converter to access resources using the converter host's network position and file permissions. For example, a malicious document could contain an image reference to an internal HTTP endpoint or an explicit `file:` URL. If the fetched content is a renderable resource, it may be embedded in the generated PDF. This is an SSRF and local-resource disclosure risk. The exact response that can be embedded depends on WeasyPrint's supported formats and the type of resource returned. ### Attack Path 1. An attacker sup ...[truncated 1815 chars]
Remediation
View remediation
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script uses yum to install fonts automatically, which performs privileged system-level changes unrelated to the minimal act of converting a Markdown file. This can modify the host environment, requires elevated privileges, and increases the risk of unintended package installation or abuse in sensitive execution environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README explicitly states that dependencies will be installed automatically on first run, but it does not warn users that executing the skill may change the local system state or invoke package installation. In an agent or automation context, silent installation behavior increases supply-chain and environment-modification risk because users may run the script expecting a pure document conversion step rather than system changes.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description and repeated guidance emphasize Chinese support and Chinese font configuration as the default behavior, but the natural-language documentation does not indicate that users can choose another locale or language preference. Under the policy, forcing a specific language or locale without opt-in is a violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The recommended workflow explicitly states that it automatically installs Python packages and system fonts, but the description does not foreground this as a security-relevant side effect. Silent or implicit package/system modification increases supply-chain and environment-integrity risk, especially in shared or production systems where executing a document conversion skill would not normally be expected to alter installed software.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script automatically installs Python packages at runtime with pip when dependencies are missing. For a document-conversion skill, this introduces network access and code installation from external package sources, expanding the trust boundary and creating supply-chain and environment-modification risk beyond simple file conversion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script performs automatic package installation via both pip and yum without explicit confirmation, which can surprise users and alter the runtime or operating system state. In an agent or automation context, silent dependency installation can trigger network access, privileged actions, and persistence of changes that are disproportionate to the user's likely expectation of a simple conversion utility.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The README is written entirely in Chinese and presents the skill as Chinese-focused without indicating that users can choose another language or locale. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The generated document sets <html lang="zh-CN">, which forces a specific language/locale regardless of the input content or user preference. Under the policy, locale constraints should either be user-selectable or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

All comments and runtime messages are presented only in Chinese, including usage and status output, with no option for users to select another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.