Back to skill

Security audit

Formula—PDF

Security checks for vulnerabilities and agentic risk

Overview

This formula-to-PDF skill mostly does what it claims, but it includes unsafe Edge cleanup behavior that could close a user's unrelated browser sessions.

Review before installing. This skill is appropriate only if you are comfortable with a Windows/Edge-based PDF workflow that loads MathJax from a CDN. Avoid using scripts/html_to_pdf_enhanced.py as-is, especially its retry cleanup and --kill-edge option, unless it is changed to terminate only the headless browser process it started. Prefer the basic workflow that does not kill Edge processes, and use local MathJax for sensitive or offline documents.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/html_to_pdf_enhanced.py:15
Finding

System-Wide Termination of Unrelated Microsoft Edge Processes

Content
View full analysis
0: kill_edge_processes() time.sleep(2) ``` It can also be invoked explicitly through a command-line option: ```python # 清理进程(如果需要) if args.kill_edge: kill_edge_processes() time.sleep(1) ``` The project documentation also recommends an equivalent global termination command in `references/lessons_learned.md:113-117` and `references/lessons_learned.md:142-145`: ```powershell Stop-Process -Name msedge -Force -ErrorAction SilentlyContinue ``` ### Technical Analysis The command `taskkill /F /IM msedge.exe` identifies processes solely by executable image name and forcibly terminates every accessible Microsoft Edge process. It does not distinguish between the headless Edge instance created for PDF conversion and unrelated interactive browser processes belonging to the user. The operation exceeds the process-control scope legitimately required to convert one HTML document. The script already launches Edge through `subprocess.run`, so cleanup should be limited to the specific child process created by that invocation. The risky function is reached automatically after an unsuccessful conversion attempt. A missing output file, conversion timeout, MathJax rendering failure, invalid input, or other retry condition ca ...[truncated 1861 chars]
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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (15)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The markdown instructs force-killing Edge processes even after acknowledging that this can kill the user's active browser windows, but it provides no warning, consent requirement, or safer alternative at the point of action. This is dangerous because an agent following the instructions could abruptly terminate live sessions, potentially causing loss of unsaved work and interruption of unrelated tasks.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

A formula-to-PDF skill does not need the capability or documented practice of indiscriminately terminating every Edge process on the host. Including this behavior expands the skill's operational impact beyond its stated purpose and can interfere with unrelated user activity, making the skill more dangerous in the context of a routine document-conversion task.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow's environment-cleanup step recommends Stop-Process -Name msedge -Force as a routine preparation step, without warning that it may terminate the user's active browsing session. In the context of an automated skill, this creates a high-likelihood unsafe action because the instruction is placed in the canonical execution flow rather than as an exceptional recovery measure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language instructions, headings, and usage guidance are all in Chinese, which can impose a fixed language on users without opt-in. The file does not indicate that the skill is intentionally region-specific or provide an alternative language option.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill instructs use of PowerShell, Edge headless, and Python-based PDF validation, but it declares no explicit tool scope or permissions. That creates an over-privileged and ambiguous execution model where an agent may invoke shell capabilities without clear restriction, increasing the chance of unintended command execution or abuse if user-controlled content is incorporated into file paths or commands.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases are very broad, such as generic requests to organize content or make a PDF, which can cause the skill to activate for routine user tasks beyond its intended narrow use case. In practice this can route unrelated content into a shell-driven workflow that writes files and launches a headless browser, increasing the attack surface and the chance of unsafe execution on untrusted input.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction "内容优先写中文" imposes a language preference on generated content, but the document does not mention user opt-in or an option to preserve the user's original language. This can violate language/locale policy when the user's preferred language is not Chinese.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The template pulls MathJax from a third-party CDN at render time, which creates a supply-chain and availability dependency outside the local HTML-to-PDF workflow the skill claims to use. If the CDN content is tampered with, blocked, or unavailable, the generated document process may execute untrusted script or fail unpredictably in the headless browser.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document contains contradictory guidance: it repeatedly warns not to kill Edge because doing so can terminate the user's active browser windows, yet later prescribes force-killing all msedge processes in the workflow and troubleshooting steps. This inconsistency is dangerous because it normalizes a destructive action that is unrelated to safe PDF rendering and can cause user disruption or data loss in active browser sessions.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
88% confidence
Finding

The script launches a local browser process on attacker-controlled HTML or file:// input without validating the source or restricting browser capabilities. In this skill context, converting untrusted HTML can trigger active content, local file access via file URLs, or outbound network requests during rendering, creating a real attack surface even though shell injection is mitigated by passing an argument list to subprocess.run.

Content

Scanner excerpt · scripts/html_to_pdf.py (reported line 77)May include surrounding context.

python
print(f"  超时: {timeout_seconds}s")
    
    # 执行
    result = subprocess.run(
        cmd,
        capture_output=True,
        text=True,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/html_to_pdf_enhanced.py (reported line 20)May include surrounding context.

python
import signal
    try:
        # Windows: 使用taskkill
        subprocess.run(["taskkill", "/F", "/IM", "msedge.exe"], 
                      capture_output=True, check=False)
        time.sleep(1)
        return True

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
89% confidence
Finding

The script launches a full browser in headless mode against a user-supplied local HTML file, which may contain active JavaScript or references to remote resources. In this context, rendering untrusted HTML can trigger network access, local file interactions within the browser context, or abuse of the host as a rendering/exfiltration primitive, especially because the tool is explicitly intended to process arbitrary user content with formulas.

Content

Scanner excerpt · scripts/html_to_pdf_enhanced.py (reported line 83)May include surrounding context.

python
]
        
        try:
            result = subprocess.run(
                cmd,
                capture_output=True,
                text=True,

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README instructs users to load MathJax from a public CDN during document rendering but does not warn that conversion will trigger outbound network requests. Even if document contents are not directly uploaded, opening the HTML in headless Edge can expose request metadata such as IP, timing, user agent, and potentially sensitive correlation about when and where documents are being processed; in stricter environments, remote script loading also expands supply-chain risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The HTML root sets lang="zh-CN", and the surrounding visible template text is also Chinese, which imposes a specific language/locale by default. The file does not provide any user opt-in, alternative locale option, or explanation that this template is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language documentation and console output entirely in Chinese, with no indication that the tool is intentionally limited to Chinese-speaking users or that another language option exists. The policy requires flagging language or locale constraints when they are imposed without user opt-in or clear justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.