Back to skill

Security audit

DOCX TO HTML CONVERTER

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a simple DOCX-to-HTML converter, but it needs review because it broadly auto-invokes for DOCX tasks and converts potentially sensitive documents into persistent, unsanitized HTML using vulnerable XML-processing dependencies.

Install only if you are comfortable converting DOCX files into persistent HTML files that may contain the full document text, embedded images, and active links. Use it on trusted documents, keep outputs in controlled locations, update or audit the npm dependencies before use, and treat generated HTML as untrusted if opened in a browser or embedded in an app.

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

Warning
Location
scripts/docx-converter.js:6
Finding
Generated HTML Is Written Without Security Sanitization## Vulnerability Details **File Location**: `scripts/docx-converter.js`, lines 6-8 **Vulnerability Type**: Unsanitized HTML generation from an untrusted DOCX document **Risk Level**: Medium **Vulnerable Code**: ```javascript const buffer = await fs.readFile(inputPath); const result = await mammoth.convertToHtml({ buffer: buffer }); await fs.writeFile(outputPath, result.value); ``` ### Technical Analysis The converter treats the DOCX input as potentially arbitrary content but writes the HTML returned by `mammoth.convertToHtml` directly to the selected output file. No allowlist-based HTML sanitization or URL-scheme validation is performed between conversion and output. Because the documented workflow recommends opening the resulting file in a browser, security-sensitive content preserved from an attacker-controlled document—particularly hyperlinks or other browser-interpreted values—may become active in the generated page. Dangerous URL schemes, unsafe embedded resources, or future parser edge cases could consequently expose users to stored cross-site scripting, unsafe navigation, or content injection. The Python wrapper does not introduce shell command injection because it invokes Node.js using an argument array rather than a shell. The issue is specifically the absence of a security boundary between untrusted document conversion and browser consumption. ### Attack Path 1. An attacker creates or supplies a crafted DOCX document containing a dangerous hyperlink or other browser-active content. 2. A user or automated system invokes the converter on that untrusted document. 3. `mammoth.convertToHtml` converts the document content into HTML. 4. The converter writes `result.value` to the output file without sanitization. 5. The user opens the generated file in a browser or embeds it in a web application, as described by the documented workflow. 6. If the dangerous content is preserved by the conversion process, the brows ...[truncated 868 chars]
Remediation
## Remediation Suggestions 1. Pass `result.value` through a maintained, allowlist-based HTML sanitizer before writing or returning it. 2. Permit only the elements and attributes required by the conversion use case. 3. Remove event-handler attributes, scripts, active embedding elements, and other executable markup. 4. Validate hyperlink and resource URL schemes. Allow only explicitly required schemes such as `https`, `http`, and optionally `mailto`; reject `javascript`, unsafe `data` uses, and other active schemes. 5. Serve converted documents from an isolated origin that has no access to application cookies or sensitive browser storage. 6. When embedding generated output, use a sandboxed iframe without unnecessary permissions. 7. Apply a restrictive Content Security Policy that disables scripts and limits navigation, frames, objects, and resource origins. 8. Add regression tests using DOCX files containing dangerous links, event-like attributes, embedded resources, and malformed XML to verify that unsafe output is removed. 9. Document that converted documents must be treated as untrusted content even when conversion completes successfully.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description presents this skill as a general-purpose DOCX handler for virtually any DOCX-related task. In contrast, the supplied code only wraps execution of a Node.js converter script to transform a DOCX file into HTML. That is consistent with one subset of the description ('convert' DOCX), but it does not support the much broader claimed capabilities such as reading arbitrary DOCX content, extracting tables/lists, summarization, browser display, or general DOCX processing workflows. There are no obvious undeclared sensitive capabilities in this snippet; the mismatch is that the declared purpose is materially broader than the actual implemented behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description is much broader than the implemented behavior. The code only accepts an input and output path, reads a DOCX file, converts it to HTML, and saves the result. It does not implement general DOCX viewing, direct content extraction APIs, summarization, table/list extraction, browser display, or AI pipeline integration. While DOCX-to-HTML conversion is one valid subset of the description, the declared purpose materially overstates the skill's capabilities compared with the actual code.

Vague Triggers

High
Confidence
97% confidence
Finding
The activation criteria are so broad that the skill may be invoked for virtually any DOCX-related request, even when unnecessary. Overbroad auto-selection increases the attack surface by routing more user workflows through shell-backed conversion steps and file-writing behavior, which can expose document contents, create unintended outputs, or bypass safer simpler handling paths.

Known Vulnerable Dependency: @xmldom/xmldom==0.8.11 — 15 advisory(ies): CVE-2026-83608 (xmldom: DocType `name` Injection Bypasses requireWellFormed); CVE-2026-41673 (xmldom: Uncontrolled recursion in XML serialization leads to DoS); CVE-2026-83605 (xmldom: Attribute name injection via setAttribute() bypasses requireWellFormed) +12 more

High
Category
Supply Chain
Confidence
92% confidence
Finding
This lockfile pins @xmldom/xmldom to 0.8.11, and the provided advisory set indicates multiple known XML parsing/serialization flaws affecting that version, including injection and denial-of-service issues. In this skill, that is especially relevant because DOCX processing inherently parses XML from user-supplied .docx files, so a malicious document could potentially trigger parser bugs during conversion or content extraction.

Lp3

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding
The skill instructs the agent to run shell commands (`npm install`, `python3 .../convert.py`) but does not declare any explicit tool scope or permission boundaries. This creates an authorization gap where an agent may invoke shell access more broadly than users or platform policy expect, increasing the chance of unsafe command execution in sensitive environments.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The documentation tells the agent to generate an HTML file and notes that images are embedded as base64, but it does not warn that the output file may contain the full document contents and embedded media in a portable form. In practice, this can lead to accidental data persistence, easier exfiltration, or unintended sharing of sensitive document contents when users expect a transient read-only operation.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
js_script = os.path.join(script_dir, "docx-converter.js")
    
    try:
        result = subprocess.run(
            ["node", js_script, input_path, output_path],
            capture_output=True,
            text=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Context-Inappropriate Capability

Medium
Confidence
90% confidence
Finding
This skill's stated purpose is DOCX conversion and content extraction, but the Python wrapper achieves that by spawning a separate executable (`node`) rather than performing the conversion internally. Launching subprocesses is a broader execution capability that is not explicitly justified by the manifest text and increases the skill's operational scope beyond straightforward document processing logic.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"license": "ISC",
  "description": "",
  "dependencies": {
    "mammoth": "^1.11.0"
  }
}
Confidence
91% confidence
Finding
The dependency version for "mammoth" is specified with a caret range (^1.11.0), which permits automatic installation of newer minor and patch releases. This creates supply-chain risk because future upstream changes could introduce malicious code or breaking behavior without an explicit review, and this skill processes untrusted DOCX input, making parser dependency integrity more security-relevant.

Static analysis

No suspicious patterns detected.