Back to skill

Security audit

skill-introduction

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but generated pages can include unsafe code from a malicious target skill's documentation.

Review before installing if you plan to generate pages for untrusted third-party skills or deploy the output. Use --no-deploy by default, configure SKILL_INTRO_DEPLOY_CMD only to a trusted local script, and treat generated HTML from untrusted skill docs as unsafe until escaping and URL validation 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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_html.py:109
Finding

Stored HTML and Script Injection Through Unescaped Skill Metadata

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_html.py, lines 109, 179, 299, 542, and 641–653
Vulnerability Type: Stored HTML injection / cross-site scripting in generated documentation
Risk Level: Medium

Relevant Code

python
# Line 109: attacker-controlled frontmatter value
name = fm.get("name", skill_dir.name)
python
# Lines 172–180: regex renderer emits text and link destinations without
# first applying HTML or attribute-context escaping
def md2html(text: str) -> str:
    if not text: return ""
    text = re.sub(r'```[\w]*\n(.*?)```', lambda m: f'<pre class="mini-code">{esc(m.group(1).strip())}</pre>', text, flags=re.DOTALL)
    text = re.sub(r'`([^`]+)`', r'<code>\1</code>', text)
    text = re.sub(r'\*\*(.+?)\*\*', r'<strong>\1</strong>', text)
    text = re.sub(r'\*(.+?)\*', r'<em>\1</em>', text)
    text = re.sub(r'\[([^\]]+)\]\(([^)]+)\)', r'<a href="\2" target="_blank">\1</a>', text)
    return text
python
# Line 299: section titles are inserted directly into markup
cards.append(f'      <div class="card"><div class="card-icon">{em_actual}</div><div class="card-title">{sec["title"]}</div><div class="card-desc">{desc}</div></div>')
python
# Line 542: author metadata is inserted directly into markup
author_html = f'维护者 <strong>{author}</strong> &nbsp;·&nbsp;' if author else ""
python
# Lines 641–653: unescaped metadata reaches the generated HTML document
<title>{name} · Skill 使用说明</title>
...
<a class="fab-install" href="{install_url}" target="_blank" rel="noopener">
  <div class="fab-circle">📦</div>
  <span class="fab-label">点我安装</span>
</a>
...
<section id="hero" class="fade-in">
  <div class="badge"><span class="badge-dot"></span>OpenClaw Skill · {name}</div>
  <h1><span class="gradient-text">{name}</span></h1>

Technical Analysis

The tool is designed to process USAGE.md or SKILL.md from another skill directory and produce a deployable HTML page. The target skill's author co ...[truncated 3009 chars]

Remediation
View remediation

Remediation Suggestions

  1. Apply HTML escaping to every plain-text value at its final output boundary, including:

    • Skill name and description.
    • Author and update metadata.
    • Section and card titles.
    • Trigger labels and list-derived summaries.
  2. Use attribute-context escaping for every value inserted into href, src, or other HTML attributes. Python's html.escape(value, quote=True) is suitable for escaping but should be combined with URL validation.

  3. Validate link schemes against an explicit allowlist such as https, http, and optionally relative fragment links. Reject dangerous schemes such as javascript:, data:, and vbscript: where they are not explicitly required.

  4. Replace the regex-based md2html() implementation with the consistently configured Markdown renderer, or escape the complete input before applying safe Markdown transformations.

  5. Consider applying a maintained HTML sanitizer to all generated Markdown fragments before inserting them into the final template.

  6. Use a template engine with automatic HTML escaping instead of constructing the document with large formatted strings.

  7. Add regression tests covering:

    • </title><script>...</script> in frontmatter names.
    • Event-handler attributes in headings and list items.
    • Quotes and angle brackets in author metadata.
    • javascript: and data: Markdown links.
    • Behavior when Mistune is unavailable and the fallback renderer is used.
Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (58)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes a complete documentation-page generator for AgentSkills, including parsing skill docs, rendering a styled standalone HTML page with multiple theme options, and optionally deploying it. The actual code chunk does none of that. It is a generic third-party Markdown parsing library entrypoint that constructs Markdown parsers and renderers and exposes helper functions. While Markdown parsing could be a supporting dependency for such a skill, this chunk by itself does not implement the declared skill behavior and instead has a materially different primary purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The code is a standalone CLI for the Mistune Markdown parser. It accepts markdown input via --message, --file, or stdin; configures plugins and renderer; converts markdown; and writes the result to stdout or a file. This is materially different from the declared purpose of generating a themed, deployable HTML introduction page for AgentSkill metadata sourced from USAGE.md or SKILL.md. None of the claimed specialized documentation-generation, theming, navigation, install-button, or deployment behaviors are present. The actual code's primary purpose is unrelated markdown rendering, so this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose describes a high-level documentation page generator for AgentSkills, including themed HTML rendering and optional deployment. The actual code chunk is unrelated support/library code for parsing Markdown blocks. It does not implement page generation, doc-site layout, theming, file selection logic, deployment, or trigger-handling. This is a clear description-to-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is for a high-level documentation-page generator and publisher for AgentSkill docs. The actual code shown is infrastructure from a third-party Markdown library: it manages parsing state, regex-based rule compilation, token rendering, and renderer registration. While such a library could be used as a supporting dependency in a documentation generator, this chunk itself does not implement the declared functionality and its primary purpose is materially different. Therefore, the supplied code does not accurately represent the declared skill behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code does not implement the declared skill behavior at all. Instead of generating a documentation/introduction HTML page for a skill, it serves as an __init__.py module for a markdown/directives library, exposing directive classes and a deprecated alias with a warning. There is no file-reading workflow for skill docs, no rendering of hero sections/cards/navigation/install button, no theme support, and no deployment functionality. This is a clear primary-purpose mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is about generating and optionally deploying HTML intro/documentation pages for skills. The actual code chunk does not read USAGE.md or SKILL.md, does not generate HTML, does not implement themes, navigation, install buttons, or deployment hooks. Instead, it is a generic vendor library component for parsing markdown directives and registering plugins with a markdown/block parser. This is a materially different primary purpose, so the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is for a skill-doc-page generator and publisher, but the supplied code is a vendor library component for parsing fenced directives in Markdown. Its primary purpose is unrelated to AgentSkill intros, page rendering, theming, deployment, or document extraction from skill metadata files. This is a clear description-to-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code is a low-level markdown/reStructuredText directive parsing component from a vendor library, not a skill-introduction-page generator. Its primary purpose is to recognize and parse '.. directive::' syntax and integrate that parser into Mistune. It does not read skill documentation files, build HTML pages, apply themes, create feature cards/navigation, or deploy output. This is a material mismatch in primary purpose and capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code chunk does not implement the declared skill behavior. It does not read USAGE.md or SKILL.md, does not extract skill metadata, does not generate a full introduction page with themes/navigation/install button, and does not deploy anything. Instead, it is a small library component that supports admonition syntax in Markdown and renders corresponding HTML. This is a materially different primary purpose, so the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes a complete skill documentation page generator and optional deployment workflow. The actual code chunk is instead a small library component for parsing and rendering Markdown image and figure directives. Its primary purpose is entirely different and much narrower: HTML generation for image-related markdown blocks. There is no evidence of reading skill metadata files, assembling a full web page, applying themes, or deploying content. This is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code does not generate a skill introduction page, parse USAGE.md/SKILL.md for metadata, apply themes, build navigation/cards/buttons, or deploy content. Instead, it is a generic Mistune 'include' directive implementation for Markdown processing that reads arbitrary local files relative to the current document and inserts their contents into rendered output. This is a materially different primary purpose and introduces undeclared file-access/include behavior unrelated to the declared skill description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description promises a complete documentation-page generator for AgentSkills, including reading specific markdown files, extracting structured content, rendering a polished multi-section page with themes, and optionally deploying it. The supplied code chunk instead belongs to a vendor Markdown library component that only provides table-of-contents directive handling for HTML rendering. Its primary purpose, inputs, outputs, and capabilities are materially different from the declared skill behavior. This is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description says this skill builds and optionally deploys a polished HTML introduction page for a target skill. However, the provided code chunk is narrowly focused on Markdown parsing internals: it parses bracketed link text, link labels, hrefs, and titles using regular expressions, and sanitizes URLs via escape_url. This is not a supporting implementation detail clearly tied to the declared page-generator behavior from the code shown; it is a generic third-party helper module with a materially different primary purpose. Therefore the description does not accurately represent the supplied code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is for a documentation-page generator and optional deployment utility targeting AgentSkill metadata files. The actual code does not read USAGE.md or SKILL.md, does not generate HTML pages, does not build themed layouts, does not create hero sections/feature cards/navigation, and does not deploy anything. Instead, it is a low-level reusable parser component for inline Markdown syntax. This is a materially different primary purpose and introduces undeclared parsing capabilities unrelated to the claimed skill behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This code chunk does not implement the declared skill behavior. The description claims a documentation-page generator with theming and optional deployment, but the actual code is a standalone Markdown list parsing component within a vendor library. Its purpose is narrowly focused on recognizing and tokenizing list constructs in Markdown. There is no evidence of HTML page generation, skill-document parsing for intro content, deployment, or any of the described UX features. This is a clear material mismatch in primary purpose and capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is for a specialized documentation-page generator for AgentSkills, with themed HTML output and optional deployment behavior. The supplied code is instead a reusable Markdown parsing component from a third-party library. It exposes parsing, rendering, plugin, and file-reading mechanics, but none of the skill-specific behaviors described: no introspection of USAGE.md/SKILL.md structure, no polished page templating, no theme support, no deployment/update hook, and no trigger-related logic. This is a clear description-behavior mismatch with a materially different primary purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes a complete documentation-page generation and optional deployment tool for AgentSkills. The actual code chunk instead implements a generic plugin import mechanism for the Mistune markdown library. It only resolves plugin references, imports modules dynamically, and caches them. None of the claimed behaviors—reading skill docs, extracting sections, generating polished HTML, supporting themes, or deploying pages—are present in this code. This is a clear purpose/behavior mismatch rather than a supporting implementation detail.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description says this skill generates polished, deployable HTML intro pages for AgentSkills from documentation files. The supplied code instead implements a markdown abbreviation plugin: it recognizes abbreviation definitions like *[HTML]: Hyper Text Markup Language, stores them in parser state, scans inline text for matching abbreviations, and renders HTML tags. This is a materially different primary purpose and an unrelated capability. There is no evidence of file discovery, skill metadata extraction, page composition, theming, deployment, or user-triggered intro-page generation. Therefore the description does not accurately represent the code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is for a documentation page generator/deployer for AgentSkill projects. The actual code chunk does not generate full pages, inspect skill directories, parse documentation files at that level, apply themes, or deploy anything. Instead, it is a low-level Markdown extension for recognizing definition lists and emitting corresponding HTML tags. This is a materially different primary purpose and an unrelated capability compared with the declared behavior, so it should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The code does not implement any of the declared intro-page generation behavior. It does not read USAGE.md or SKILL.md for skill metadata, does not build a themed landing page, does not create hero sections, feature cards, navigation, install buttons, or deployment hooks. Instead, it exclusively adds footnote support to a Markdown parser by recognizing [^key] syntax and rendering corresponding HTML footnotes. This is a materially different primary purpose and unrelated to the declared skill description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description says this skill generates and optionally deploys a full HTML introduction page for AgentSkills by reading documentation files and building themed documentation pages. The actual code chunk does none of that. It only defines markdown inline parsing and HTML rendering helpers for formatting syntax in the Mistune library. This is a materially different primary purpose and lacks the described file access, page generation, theming, deployment, and interaction behavior. Therefore the description does not accurately represent the supplied code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied code does not read skill metadata files, generate a documentation/introduction page, apply themes, create navigation or feature cards, or deploy anything. Its sole purpose is to extend a Markdown parser with math syntax support. This is a materially different primary purpose from the declared skill description, so the description does not accurately represent the code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description is about a documentation-page generator for AgentSkill metadata and markdown files, potentially with deployment support and themed page rendering. The supplied code does none of that. Instead, it implements a low-level markdown plugin for ruby/furigana markup in the Mistune parser. It neither reads USAGE.md/SKILL.md for skill intros, nor builds full HTML doc pages, nor supports themes, navigation, install buttons, or deployment hooks. This is a materially different primary purpose, so it is a clear mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

There is a clear mismatch between the declared description and the supplied code. The description claims an end-user documentation/page-generation skill for AgentSkills, including file reading, content extraction, HTML rendering, theming, and optional deployment. The actual code is a small internal markdown-parsing optimization plugin from Mistune. Its sole purpose is to speed up paragraph and text parsing by registering custom regex-based block and inline parsers. No functionality related to discovering target skills, reading USAGE.md/SKILL.md, building HTML pages, applying themes, or deploying content is present in this code chunk. This is not merely an implementation detail; the code's primary purpose is materially different from the declared skill behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes a full documentation-page generator for AgentSkills, including reading specific files, parsing skill metadata/features, rendering themed intro pages, and optionally deploying them. The actual code does none of that. Instead, it implements a markdown extension for spoiler syntax in the Mistune library. It neither reads USAGE.md/SKILL.md, nor generates a skill intro page, nor applies themes, navigation, install buttons, or deployment hooks. This is a materially different primary purpose, so it is a clear mismatch.

Content

No source excerpt is available for this finding.