Back to skill

Security audit

Markdown Tool

Security checks for vulnerabilities and agentic risk

Overview

This Markdown converter is mostly purpose-aligned, but its generated HTML can preserve attacker-controlled scripts or dangerous links when processing untrusted Markdown.

Review before installing. Use this only on Markdown you trust, and avoid opening generated HTML from untrusted documents in a privileged browser context. The skill does not show exfiltration, persistence, or hidden system access, but its converter output is unsafe enough that users should treat it as a review-risk package until HTML escaping, URL validation, and capability documentation are fixed.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/md.py:58
Finding

Unescaped Markdown Content Allows Script Injection in Generated HTML

Content
View full analysis
{text}') continue ``` ```python # Paragraph if line.strip(): html_lines.append(f'

{line}

') else: html_lines.append('') ``` ### Technical Analysis Markdown input is treated as trusted HTML when processing fenced-code content, headings, and paragraphs. The converter does not apply `html.escape()` or an allowlist-based sanitizer before inserting attacker-controlled strings into the generated document. Consequently, raw HTML elements and executable event attributes are retained. For example, input such as: ```markdown ``` is emitted inside a paragraph without neutralizing the `` element or its `onerror` handler. Content inside fenced code blocks is also inserted directly between `
text
` tags, so an attacker can provide closing tags followed by active HTML:

```markdown
```
``` ``` This is an output-generation vulnerability rather than command execution in the Python process. Exploitation occurs when the resulting HTML is rendered by a browser or another HTML-capable consumer. ### Attack Path 1. An attacker creates or modifies a Markdown document containing raw HTML, an event-handler payload, or a payload that closes a code element. 2. A user or automated workflow processes the document with `scripts/md.py`. 3. The script inserts the malicious input directly into the generated standalone HTML. 4. The generated HTML is opened in a browser or embedded in an HTML viewer. 5. The payload executes in th ...[truncated 686 chars]
Remediation
View remediation
{html.escape(text)}') html_lines.append(f'

{html.escape(line)}

') ``` 2. Escape fenced-code content unconditionally. Code blocks must never be interpreted as HTML. 3. Prefer a maintained Markdown implementation configured to disable raw HTML. 4. If raw HTML is a required feature, sanitize the final output with an allowlist-based HTML sanitizer. Remove script-capable elements, event-handler attributes, dangerous URL schemes, SVG scripting features, and unsafe CSS. 5. Apply a restrictive Content Security Policy when serving generated documents, such as prohibiting inline scripts. CSP should be defense in depth rather than a substitute for escaping. 6. Add regression tests covering `

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/markdown.py:30
Finding

Unsafe Link Schemes Are Preserved in HTML Output

Content
View full analysis
\1', text) # Images text = re.sub(r'!\[([^\]]*)\]\(([^)]+)\)', r'\1', text) ``` ### Technical Analysis The function escapes input with `html.escape()` before these substitutions, which limits direct quote-based attribute breakout in this script. However, escaping HTML metacharacters does not validate the semantic meaning of a URL. Markdown destinations are copied into `href` or `src` without parsing or restricting their schemes. A destination using a script-capable scheme can therefore survive conversion. For example: ```markdown [Open report](javascript:alert(document.domain)) ``` produces an anchor whose `href` begins with `javascript:`. When a victim activates the link in a browser that permits this behavior, the JavaScript executes in the generated document's context. Potentially dangerous schemes include `javascript:`, `vbscript:` in legacy consumers, and some forms of `data:` URLs. Scheme checks must account for case variations and URL normalization rather than relying on a simple case-sensitive prefix test. ### Attack Path 1. An attacker supplies Markdown containing a link with a dangerous URL scheme. 2. The document is converted using `scripts/markdown.py`. 3. The converter emits the destination into an HTML `href` without scheme validation. 4. A victim opens the generated output and follows the crafted link. 5. The browser interprets the destination as active content and may execute it in the document context. ### Impact Assessment Exploitation generally requires user interaction with the malicious link. Successful exploitation can execute JavaScript in the generated page, manipulate its content, display phishing interfaces, initiate network requests, and acc ...[truncated 240 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/md.py:71
Finding

Unescaped Link Attributes Permit Attribute Injection and Dangerous URLs

Content
View full analysis
\1', line) # Images line = re.sub(r'!\[([^\]]*)\]\(([^\)]+)\)', r'\1', line) ``` ### Technical Analysis Both the displayed text and destination captured by the regular expressions are inserted into HTML without HTML attribute escaping, URL validation, or final sanitization. A destination containing a quotation mark can terminate the intended `href` attribute and inject additional attributes. For example: ```markdown [Open](https://example.invalid/" onmouseover="alert(document.domain)) ``` can generate markup equivalent to: ```html Open ``` The destination can also use a dangerous scheme such as `javascript:`. In addition, link text is inserted without escaping, so active HTML can be introduced through the visible-label capture. The image replacement occurs after link replacement, meaning ordinary image syntax may first be partially transformed as a link. This parser-order defect does not mitigate the underlying unsafe interpolation and makes the resulting behavior less predictable. ### Attack Path 1. An attacker supplies a Markdown document containing a quoted destination, dangerous scheme, or HTML-bearing link text. 2. A user converts the document with `scripts/md.py`. 3. The regular-expression replacement inserts attacker-controlled captures into HTML attributes and element content. 4. The generated document is opened in a browser. 5. The payload executes when its event fires, when the victim follows the link, or immediately if the injected markup provides an automatic execution primitive. ### Impact Assessment This issue permits attacker-controlled markup and JavaScr ...[truncated 557 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code largely matches the declared Markdown conversion purpose: it parses Markdown syntax and renders HTML, supports file/stdin input, output files, and styling for standalone HTML. However, the description says it converts to HTML and other formats, implying genuine multi-format conversion. In reality, only HTML conversion is implemented. The only alternative format exposed is JSON, which is explicitly not implemented and returns a placeholder message. There are no suspicious undeclared capabilities, resource accesses, or unrelated triggers, but the declared breadth of format support overstates the actual behavior.

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.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes a Markdown conversion and formatting tool, and the module/docstrings focus on processing Markdown files. However, the CLI defines a '--serve' option, which implies an additional service-hosting capability outside straightforward document transformation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The help text for '--serve' says 'Start server', which actively communicates behavior to users. No later code references 'args.serve' or implements any server logic, so the documented intent contradicts the actual behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes a Markdown converter for HTML and other formats, implying multiple implemented output formats. In the code, the only real conversion path is HTML; selecting JSON yields the literal string "JSON output not implemented" rather than an actual converted format.

Content

No source excerpt is available for this finding.