Back to skill

Security audit

1688 Common Html Report Generator

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent local HTML report generator, but generated reports can run unsanitized HTML or JavaScript from input data and load a remote script when opened.

Install only if you will generate reports from trusted data or can review/sanitize inputs before sharing the HTML. Avoid hosting generated reports on authenticated or sensitive origins until the builder escapes text fields, validates IDs, restricts raw HTML to trusted use, and preferably 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate.py:135
Finding

Stored HTML and JavaScript Injection in Generated Reports

Content
View full analysis
'] parts.append(f'
{self.num}{self.title}
') parts.append(f'
{self.desc}
') self.builder._sections_html.append("\n".join(parts)) self.builder._in_section = True return self ``` ```python def table(self, headers: list, rows: list): ths = "".join(f"{h}" for h in headers) trs = "" for row in rows: tds = "".join(f"{cell}" for cell in row) trs += f"{tds}" html = f'{ths}{trs}
' self._add_html(html) return self ``` ```python def raw_html(self, html: str): self._add_html(html) return self ``` ```python def insight(self, title: str, bullets: list): lis = "".join(f"
  • {b}
  • " for b in bullets) html = f'

    {title}

      {lis}
    ' self._add_html(html) return self ``` ```python # 替换占位符 tmpl = tmpl.replace("{{TITLE}}", self.title) tmpl = tmpl.replace("{{HEADER_TITLE}}", self._header_title) tmpl = tmpl.replace("{{HEADER_SUBTITLE}}", self._header_sub) tmpl = tmpl.replace("{{HEADER_META}}", meta_html) tmpl = tmpl.replace("{{NAV_LINKS}}", nav_html) tmpl = tmpl.replace("{{SECTIONS}}", sections_html) tmpl = tmpl.replace("{{FOOTER}}", self._footer) tmpl = tmpl.replace("{{CHART_SCRIPTS}}", charts_js) tmpl = tmpl.replace("__CHART_INSTANCES__", f"[{instances_str}]") ``` The associated documentation expressly permits arbitrary HTML: ```python ## raw_html r.raw_html('
    任意 HT ...[truncated 2854 chars]
    Remediation
    View remediation
    alert(1)` - `` - `" onmouseover="alert(1)` - `` 9. Clearly document which APIs accept plain text and ensure safe APIs are the default. ]]>

    T08 · Insecure Dependencies

    Warning
    Location
    scripts/template.html:7
    Finding

    Remote JavaScript Dependency Loaded Without Subresource Integrity

    Content
    View full analysis
    ``` ### Technical Analysis Every generated report loads and executes ECharts from an external CDN when the report is opened. The dependency is version-pinned, which reduces unintended version drift, but the script element has no Subresource Integrity (`integrity`) attribute. Consequently, the browser trusts whatever JavaScript is returned from that URL at viewing time. This means the effective executable content is not fully contained in the audited project. If the CDN account, hosted asset, delivery infrastructure, DNS resolution, or relevant trust chain is compromised, altered JavaScript could execute in all reports that reference the resource. The remote reference also causes the browser to contact the CDN whenever a report is opened, disclosing ordinary connection metadata such as the user's IP address and user agent. Reports may also fail to render correctly in offline or network-restricted environments. ### Attack Path 1. A report is generated from `template.html` and retains the external ECharts script reference. 2. An attacker compromises or otherwise gains the ability to alter the JavaScript response delivered for that CDN URL. 3. A recipient opens the generated report while the malicious response is being served. 4. The browser downloads the response because the report trusts the CDN URL. 5. Because no integrity hash is specified, the browser does not verify that the downloaded bytes match the reviewed ECharts release. 6. The malicious script executes with the same browser-origin privileges as the report and can manipulate the document or initiate network requests. ### Impact Assessment A successful supply-chain compromise would permit arbitrar ...[truncated 605 chars]
    Remediation
    View remediation
    ``` 3. Obtain the hash independently from the exact reviewed asset; do not copy an unverified value. 4. Enforce a restrictive Content Security Policy that limits scripts to the selected local source or explicitly approved CDN. 5. Maintain a documented process for dependency review, vulnerability monitoring, and controlled upgrades. 6. Consider generating reports with all required JavaScript embedded or packaged locally to support offline use and eliminate runtime dependency substitution. ]]>
    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
    • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
    Findings (11)

    Undeclared Tool Scope

    Medium
    Category
    MCP Least Privilege
    Confidence
    92% confidence
    Finding

    The skill instructs the agent to read user-provided files, read an internal reference document, create Python scripts in the workspace, and render output files, but it declares no explicit tool scope or permissions. That mismatch can cause an agent runtime to grant broader file capabilities than intended or make the skill callable in contexts where file access was not clearly authorized.

    Content

    No source excerpt is available for this finding.

    Vague Triggers

    Medium
    Category
    Not specified by scanner
    Confidence
    91% confidence
    Finding

    The trigger phrases include broad everyday requests like '数据可视化' and '生成HTML报告', which are common across many benign interactions. Overly broad activation can cause the skill to run unexpectedly, leading the agent to read files and generate code/output in situations the user did not specifically intend.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The documentation explicitly exposes a raw HTML passthrough API (r.raw_html) that allows arbitrary HTML injection into generated reports, but it provides no warning, sanitization guidance, or trust-boundary constraints. In an HTML report generator context, this is dangerous because user-controlled HTML can enable script injection, DOM manipulation, phishing UI, or data exfiltration if untrusted content is embedded and viewed in a browser.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    94% confidence
    Finding

    The module docstring is entirely in Chinese and presents the skill's usage only in that language, which can impose a language choice on users without opt-in. The file also continues this pattern in user-facing strings, and there is no indication that the tool is intentionally limited to a Chinese-only region or audience.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    91% confidence
    Finding

    The raised RuntimeError message is user-visible and fixed to Chinese, and similar Chinese-only output appears elsewhere in the file. Without a documented locale constraint or a way for users to select their preferred language, this violates the language/locale policy described in SQP-3.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Medium
    Category
    Not specified by scanner
    Confidence
    96% confidence
    Finding

    The raw_html() API directly appends arbitrary HTML into the generated report without any sanitization or trust boundary, enabling script injection, event-handler injection, and hostile markup if any untrusted data is passed through it. In an HTML-report generator, this becomes a stored XSS/code-execution sink in the produced file, which is especially risky because reports are meant to be opened interactively in a browser.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Medium
    Category
    Not specified by scanner
    Confidence
    94% confidence
    Finding

    chart_script() interpolates cid directly into JavaScript variable declarations and DOM lookups, so a crafted chart ID can break out of the intended syntax and inject arbitrary JavaScript into the generated page. Because the output is an executable HTML document, this is a direct code-injection sink, not just malformed output.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    91% confidence
    Finding

    The template declares lang="zh-CN" and uses Chinese-specific font choices as the default presentation, which imposes a specific language/locale on all rendered outputs. There is no visible opt-in, alternative locale handling, or justification that this template is only for a China-specific context.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The template pulls ECharts from a third-party CDN at runtime, which creates an external trust dependency for a skill marketed as local text-to-HTML report generation. If the CDN is unavailable, tampered with, blocked, or monitored, generated reports may fail to render or may execute attacker-controlled JavaScript in the viewer's browser.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Low
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    All natural-language guidance in the file is presented in Chinese, and there is no indication that users can choose another language or that the skill is intentionally restricted to a Chinese-speaking context. Under the language/locale policy, forcing a specific language without user opt-in can be a policy violation.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Low
    Category
    Not specified by scanner
    Confidence
    83% confidence
    Finding

    render() writes to an arbitrary caller-supplied out_path with no restriction to a designated output directory, allowing path traversal or overwrite of unintended files when the API is exposed to untrusted input. In an agent skill context, arbitrary file write can become more dangerous because skills often run with access to workspace files or shared artifacts.

    Content

    No source excerpt is available for this finding.

    Static analysis

    No suspicious patterns detected.