Back to skill

Security audit

财务图表制作展示 Financial Charts

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent chart-generation purpose, but generated HTML can execute unsafe user-supplied content and unverified third-party JavaScript when opened.

Review before installing. Use this only with trusted chart titles and financial data, and be aware that opening generated charts loads JavaScript from jsDelivr. A safer version should escape HTML/script data and either bundle ECharts locally or use integrity-checked dependencies.

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

T09 · Insecure Skill Coding Practices

Error
Location
generate-chart.js:343
Finding
Generated HTML Allows Script Injection Through Untrusted Chart Content<![CDATA[ ## Vulnerability Details **File Location**: `generate-chart.js`, lines 343-451 **Vulnerability Type**: HTML injection and inline-script breakout **Risk Level**: High ### Vulnerable Code ```javascript <title>${title}</title> ``` ```javascript <h1 class="chart-title">${title}</h1> ``` ```javascript <script> const chart = echarts.init(document.getElementById('chart')); const option = ${JSON.stringify(option, null, 2)}; window.addEventListener('resize', () => { chart.resize(); }); chart.setOption(option); </script> ``` ### Technical Analysis The `--title` command-line value is interpolated directly into both the HTML `<title>` element and an `<h1>` element without context-appropriate HTML escaping. A crafted value containing closing tags and executable markup can therefore escape the intended element and insert arbitrary HTML or JavaScript. Chart data is also serialized with `JSON.stringify()` and embedded directly inside an executable `<script>` element. JSON serialization does not make a value safe for an HTML script context. In particular, a user-controlled string containing `</script>` is recognized by the HTML parser as the end of the script element even when that sequence occurs inside a JavaScript string literal. An attacker can follow it with a new `<script>` element containing arbitrary JavaScript. The generated file is explicitly intended to be opened in a browser, so the injected content reaches an executable sink as part of the normal workflow. ### Attack Path 1. An attacker supplies or persuades a user to process crafted financial data or a crafted chart title. 2. The title can contain a payload such as a closing `</title>` or `</h1>` tag followed by a malicious `<script>` element. 3. Alternatively, a chart label can contain an inline-script breakout sequence such as `</script><script>/* attacker code */</script>`. 4. The program inserts the malicious value into the generated HTML without safe encoding. ...[truncated 894 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Escape the title separately for each HTML context. For text content, encode at least `&`, `<`, `>`, `"`, and `'`. 2. Prefer constructing text nodes with `textContent` rather than inserting user-controlled values into an HTML template. 3. Do not embed raw JSON in an executable script context. Encode HTML-significant characters after serialization, for example: ```javascript function serializeForInlineScript(value) { return JSON.stringify(value) .replace(/</g, '\\u003c') .replace(/>/g, '\\u003e') .replace(/&/g, '\\u0026') .replace(/\u2028/g, '\\u2028') .replace(/\u2029/g, '\\u2029'); } ``` 4. Prefer placing serialized data in a non-executable `<script type="application/json">` element and reading it through `textContent`, while still safely encoding closing-tag sequences. 5. Validate the complete input schema, including expected data types and maximum string lengths. 6. Validate custom colors against a strict allowlist of accepted CSS color formats before interpolating them into styles. 7. Add a restrictive Content Security Policy after removing inline executable code, such as one permitting scripts only from a controlled local source. 8. Add automated tests covering payloads containing `</script>`, closing HTML tags, quotes, ampersands, and Unicode line separators. ]]>

T08 · Insecure Dependencies

Warning
Location
generate-chart.js:344
Finding
Remote ECharts Dependency Is Executed Without Subresource Integrity<![CDATA[ ## Vulnerability Details **File Location**: `generate-chart.js`, line 344 **Vulnerability Type**: Unverified remote executable dependency **Risk Level**: Medium ### Vulnerable Code ```html <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script> ``` ### Technical Analysis Every generated chart loads and executes ECharts JavaScript from a third-party CDN when the HTML file is opened. Although the dependency version is pinned to `5.4.3`, the script element has no Subresource Integrity (`integrity`) attribute. The generated page also has no restrictive Content Security Policy. Consequently, the browser trusts the content returned by the remote host at runtime rather than a cryptographically verified artifact reviewed with the Skill. Compromise of the CDN, package publication infrastructure, or another part of the delivery chain could alter the code executed by generated chart pages. ### Attack Path 1. An attacker compromises or successfully interferes with the remote dependency delivery chain. 2. The attacker causes the referenced CDN resource to return modified JavaScript. 3. A user opens a generated chart while connected to the network. 4. The browser retrieves the script from the CDN without checking an expected cryptographic digest. 5. The modified script executes with the same browser privileges as the chart application. ### Impact Assessment A compromised dependency can execute arbitrary JavaScript in every generated chart that loads the affected resource. It could: - Read and alter all financial data rendered by the chart. - Replace the chart with deceptive or malicious content. - Send chart data to an external server. - Perform arbitrary network requests available to the page. - Exploit any browser capabilities available to the page's execution context. The scope is the browser context of generated pages that load the remote resource. This finding does not independently establish operating-system-level code ...[truncated 15 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer bundling a reviewed ECharts distribution with the Skill and reference it through a local relative path. 2. If the CDN must be used, calculate and specify the exact Subresource Integrity digest: ```html <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js" integrity="sha384-REPLACE_WITH_VERIFIED_DIGEST" crossorigin="anonymous"></script> ``` 3. Obtain the digest from a trusted build or calculate it from an independently verified artifact; do not copy an unverified digest from the same delivery channel. 4. Add a restrictive Content Security Policy that limits scripts to explicitly trusted sources and blocks unexpected inline execution. 5. Maintain an inventory of the bundled dependency version and periodically review it for known vulnerabilities. 6. Ensure generated charts fail safely if dependency verification or loading fails rather than falling back to an unverified source. ]]>
Vulnerability Patterns
  • 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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The generated HTML sets `lang="zh-CN"`, and the script also uses Chinese-only titles and user-facing text elsewhere, which indicates a forced locale. The policy allows locale constraints only when the user is given a choice or the restriction is clearly documented and justified, neither of which appears in this file.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The manifest description and section content are written entirely in Chinese and describe the skill's behavior without offering any language choice or indicating that it is limited to Chinese-speaking users. This creates a natural-language policy concern because it effectively imposes a specific language/locale without user opt-in or a documented regional justification.

Static analysis

No suspicious patterns detected.