Back to skill

Security audit

Mysteel_ChartGeneration

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent chart generator, but its generated HTML can execute unsafe JavaScript from user/API-controlled content and it sends chart data plus an API token to external services.

Review before installing. Use this only with chart data you are comfortable sending to Mysteel's external API, store the API key with care, avoid opening generated HTML from untrusted inputs or hosting it on a trusted origin, and prefer a fixed renderer that escapes HTML/script content and bundles or integrity-pins ECharts.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/render_html.py:43
Finding

Stored HTML Injection Through an Unescaped Chart Title

Content
View full analysis
{title} ``` The same unescaped title is also inserted into the page body: ```python

{title}

AI智能生成的可视化图表

``` The title may originate from the user-controlled task in `scripts/generate_chart.py`: ```python chart_title = generate_title_from_task(task) meta_file = output_path / f"{request_id}_meta.json" meta_info = { 'requestId': request_id, 'task': task, 'title': chart_title } meta_file.write_text( json.dumps(meta_info, indent=2, ensure_ascii=False), encoding='utf-8' ) ``` ### Technical Analysis The title is read from a metadata JSON file or supplied through the `--title` command-line option and then interpolated directly into the generated HTML. It is used in both the HTML `` element and an `<h1>` element without context-appropriate HTML escaping. JSON parsing does not sanitize HTML. Consequently, a title containing HTML markup can break out of the intended text context and introduce arbitrary elements or executable script. The automatic title-generation ...[truncated 1739 chars]
Remediation
View remediation
{safe_title} ...

{safe_title}

``` 3. Keep the raw title and HTML-escaped title as separate variables to prevent accidental reuse in incompatible contexts. 4. Enforce a reasonable title length and reject unexpected control characters. 5. Add a restrictive Content Security Policy to generated pages. For example, after removing inline executable code: ```html ``` 6. Add regression tests with titles containing: - `

T09 · Insecure Skill Coding Practices

Error
Location
scripts/render_html.py:131
Finding

Script-Context Injection Through Embedded ECharts Configuration

Content
View full analysis
// 初始化图表 var chartDom = document.getElementById('chart'); var myChart = echarts.init(chartDom); // 图表配置 var option = {option_json}; // 渲染图表 myChart.setOption(option); ``` ### Technical Analysis `json.dumps()` produces syntactically valid JSON, but JSON serialization alone does not make a value safe for insertion into an HTML `` sequence even when it appears inside a JavaScript or JSON string. Therefore, an option string containing a sequence such as: ```html ``` can terminate the intended script element and introduce attacker-controlled executable markup. The option configuration can originate from: - A caller-supplied option JSON file. - Chart data returned by the remote chart-generation API. - Data influenced by an attacker through the chart task or supplied chart values. Although the file must contain valid JSON, the malicious sequence is valid within a JSON string and survives parsing and serialization. ### Attack Path 1. An attacker supplies a crafted ECharts option file or causes the remote service to return an option containing: ```json { "title": { "text": "" } } ``` 2. `render_html.py` parses the file successfully because the payload is a valid JSON string. 3. The script serializes the object with `json.dumps()`. 4. The serialized JSON is inserted directly into the body of an executable `
Remediation
View remediation
', '\\u003e') .replace('\u2028', '\\u2028') .replace('\u2029', '\\u2029') ) ``` 3. Prefer storing the configuration in a non-executable JSON element: ```html ``` Then parse its text content: ```javascript const option = JSON.parse( document.getElementById('chart-option').textContent ); ``` The JSON still must encode `<` as `\u003c` so that `` cannot terminate the element. 4. Alternatively, generate the chart configuration as a separate `.json` resource and load it under a controlled same-origin policy. 5. Apply a restrictive Content Security Policy that blocks unauthorized scripts and avoids `'unsafe-inline'`. 6. Treat remote API output as untrusted input. Validate the returned option structure and reject unexpected fields, excessive nesting, unsupported value types, and dangerous string content. 7. Add regression tests using literal `` sequences in chart titles, labels, tooltip text, series names, and other string-valued ECharts fields. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/render_html.py:124
Finding

Runtime JavaScript Dependency Loaded Without Integrity Verification

Content
View full analysis
``` ### Technical Analysis Every generated HTML file downloads and executes ECharts from a third-party CDN when opened. The dependency version is pinned to `5.4.3`, which reduces accidental version drift, but the script element does not include a Subresource Integrity hash. Without integrity verification, the browser trusts whatever executable content is returned from the CDN URL at viewing time. The effective code executed by the generated page can therefore differ from the code that was present or expected during the Skill audit. This behavior introduces a runtime supply-chain trust dependency on jsDelivr, its upstream package source, DNS resolution, TLS infrastructure, and the availability and immutability of the referenced artifact. ### Attack Path 1. The Skill generates an HTML chart containing the external script reference. 2. A user opens the chart while connected to the network. 3. The browser requests the ECharts file from jsDelivr. 4. If the CDN account, distribution path, upstream artifact, DNS/TLS trust chain, or delivery infrastructure is compromised, an altered JavaScript response may be returned. 5. Because no integrity hash is specified, the browser accepts and executes the altered script. 6. The malicious script runs with the same browser-page privileges as the legitimate ECharts library. ### Impact Assessment A compromised runtime dependency could execute arbitrary JavaScript in every generated chart opened while the malicious resource is served. It could: - Read and alter chart content. - Exfiltrate chart data to an external service. - Redirect viewers or display phishing content. - Access browser storage and cookies available to ...[truncated 373 chars]
Remediation
View remediation
``` 2. If the CDN must be retained, calculate and verify the official artifact hash and add Subresource Integrity: ```html ``` The placeholder must be replaced with the independently verified hash of the exact artifact. 3. Pin the dependency by exact version and maintain a documented process for reviewing and updating it. 4. Add a Content Security Policy that permits scripts only from the required local or explicitly approved source. 5. Consider producing self-contained offline HTML output so chart rendering does not depend on network access. 6. Maintain a software bill of materials and periodically review the pinned ECharts version for known vulnerabilities. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (13)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The STRICT mode description states that the AI generates Python code and automatically executes it, but the document includes no sandboxing, validation, isolation, or trust-boundary warning. Automatic execution of model-generated code against user-supplied data is a serious risk because prompt/data injection or implementation flaws could lead to arbitrary code execution, data exfiltration, or service compromise.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill instructs the agent to read a local API key file, invoke scripts, write output HTML/JSON files, and make authenticated network requests, but it declares no explicit tool scope or permission boundaries. In an agent environment, this creates an over-privileged integration surface where broad file and network access may be granted implicitly, increasing the chance of secret exposure, unintended file access, or unreviewed outbound requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

L003 的技能描述完全以中文表述,文件整体也默认中文交互与示例,但未说明这是面向特定中文场景的限定,也未给出用户可选择语言的机制。按照语言/地区策略,未经用户选择而隐含固定语言属于自然语言政策风险。

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger conditions are broad enough to match common requests such as 'generate a chart' or 'visualize data,' which can cause the skill to activate in routine conversations without strong user intent verification. In this skill, misfires are more dangerous because activation can lead to local file reads, output file creation, and authenticated API calls using a stored key.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation instructs callers to send a token credential to a remote API endpoint but provides no warning about credential handling, storage, scope, or transport/privacy considerations. In a skill context, this can normalize unsafe secret sharing and increase the chance that users expose API keys or sensitive chart data to an external service without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script sends task text, optional data, data examples, descriptions, options, and session identifiers to an external service, but provides no clear disclosure to the operator about the scope of outbound data sharing. In a chart-generation skill, users are likely to submit internal analytics or commercially sensitive datasets, making silent exfiltration to a third-party endpoint a real confidentiality risk.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/generate_chart.py (reported line 181)May include surrounding context.

python
}
    
    try:
        response = requests.post(url, json=payload, headers=headers, timeout=30)
        
        if response.status_code >= 400:
            raise Exception(f"HTTP请求失败: 状态码 {response.status_code}, 响应内容: {response.text}")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script persists user-supplied task content and API-returned chart configuration to local JSON files without any warning, redaction, or sensitivity controls. If users include confidential business data, identifiers, or proprietary prompts, that information may be left on disk in predictable locations and later exposed to other local users, backups, or log collection systems.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The generated HTML unconditionally loads ECharts from a third-party CDN at runtime, which introduces externally hosted executable JavaScript into an otherwise local rendering flow. If the CDN is unavailable, blocked, or serves compromised content, every opened chart page executes untrusted remote code in the viewer's browser, expanding the trust boundary unnecessarily for this skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file forces a single language presentation throughout the skill documentation, and there is no indication that users may choose another language or that the Chinese-only constraint is intentional for a region-specific purpose. This can violate a language or locale policy when no opt-in or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

该代码文件中的自然语言说明、异常提示和CLI帮助均为中文,且没有提供多语言选项或声明仅面向中文用户。按照语言/locale 政策,这构成未经用户选择的语言强制。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The documentation narrows failure modes to missing or malformed config files, but the function also reads a separate meta file and the script's error path calls sys.exit at L178 even though sys is never imported. This is not just incomplete detail: the documented error behavior does not match the actual execution paths and failure causes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The generated HTML hard-codes lang="zh-CN", which imposes a specific locale in the output regardless of user preference. Under the policy, locale constraints should be optional or clearly justified; this file does not offer a user choice or explain why the output must be Chinese-localized.

Content

No source excerpt is available for this finding.