Back to skill

Security audit

电商商品兴趣度分析

Security checks for vulnerabilities and agentic risk

Overview

The skill’s ecommerce analysis purpose is coherent, but generated HTML reports can execute injected JavaScript if the input data is malicious.

Install only if you trust the datasets used to generate reports, and avoid opening or sharing generated HTML reports from untrusted CSV/JSON inputs until the report generator escapes HTML and safely serializes JavaScript values. For sensitive business data, also consider replacing the CDN-loaded Chart.js with a local bundled copy.

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

Error
Location
scripts/report_generator.py:75
Finding

Persistent HTML and JavaScript Injection in Generated Reports

Content
View full analysis
{s}' for s in c["suggestions"] ) if c["suggestions"] else "
  • 文案基本OK
  • " # Diagnostic finding list findings_items = "".join( f'
  • {f}
  • ' for f in d["detailed_findings"] ) card = f"""
    #{idx + 1}

    {p['product_name']}

    价格: ¥{p['product_price']:.2f} | 品类: {p.get('category', '通用')} | 样本: {p['total_users']}人
    Remediation
    View remediation
    {escape(str(item), quote=True)}" for item in c["suggestions"] ) findings_items = "".join( f"
  • {escape(str(item), quote=True)}
  • " for item in d["detailed_findings"] ) ``` 2. Do not place data into JavaScript by surrounding an interpolated value with quotes. Serialize the entire value as JSON: ```python product_name_js = json.dumps( str(p["product_name"]), ensure_ascii=False ) ``` Then use it without additional JavaScript quotes: ```javascript label: {product_name_js}, ``` 3. Defend against script-element termination. Because JSON embedded inside an inline `script` element can contain ``, either: - Replace `<` with its Unicode escape form in serialized JavaScript data, or - Place report data in a non-executable JSON element and parse it safely, or - Move report data into an external JSON file loaded by trusted static JavaScript. Example: ```python def safe_json_for_script(value): return json.dumps(value, ensure_ascii=False).replace("<", "\\u003c") ``` 4. Prefer DOM-safe rendering with `textContent` instead of building HTML through string interpolation. 5. Add a restrictive Content Security Policy. Remove inline scripts where possible and use a nonce or hash for trusted code. For example: ```html ` ...[truncated 690 chars]
    Vulnerability Patterns
    • 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
    • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
    Findings (10)

    Tp4

    High
    Category
    MCP Tool Poisoning
    Confidence
    94% confidence
    Finding

    Most of the declared purpose is represented: the code analyzes e-commerce product behavioral data, computes weighted interest scores, performs basic NLP-style copy analysis, and diagnoses price/copy issues. However, a key declared capability is missing: interactive HTML visualization report generation. The script only writes JSON output and prints terminal summaries. The description also mentions manual data entry, but this code chunk only supports CSV/JSON file input through a CLI. These are material differences in user-facing functionality, so this should be flagged as a mismatch.

    Content

    No source excerpt is available for this finding.

    Undeclared Tool Scope

    Medium
    Category
    MCP Least Privilege
    Confidence
    90% confidence
    Finding

    The skill instructs the agent to read input files and write JSON/HTML outputs, but it does not declare any explicit tool scope such as allowed files, directories, or permissions. That creates unnecessary ambiguity around what filesystem access the skill may exercise and increases the chance of over-broad file access in environments that honor skill instructions loosely.

    Content

    No source excerpt is available for this finding.

    Vague Triggers

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    An overly broad trigger phrase can cause the skill to activate in unintended contexts, leading users to share files or business data with the wrong workflow. In a skill that reads local files and generates reports, accidental invocation increases the risk of inappropriate data handling and user confusion.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    87% confidence
    Finding

    The skill description and trigger set are written entirely in Chinese and present the assistant as a Chinese-language tool, but do not state that this locale restriction is optional or region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

    Content

    No source excerpt is available for this finding.

    Context-Inappropriate Capability

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The skill states that all data is processed locally, but the generated HTML loads Chart.js from a CDN. Opening the report may therefore leak metadata such as IP address, user agent, timing, and possibly contextual referrer information to a third party, which contradicts the local-processing claim and can be sensitive in commercial analytics contexts.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    This code file contains user-facing natural-language descriptions and CLI help text that are exclusively in Chinese, starting with the module docstring. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the constraint is explicitly documented and justified.

    Content

    No source excerpt is available for this finding.

    Description-Behavior Mismatch

    Medium
    Category
    Not specified by scanner
    Confidence
    96% confidence
    Finding

    The manifest description says the skill generates an '交互式HTML可视化诊断报告', implying HTML report rendering and visualization output. In this file, the analysis pipeline builds a Python dict, writes it as JSON, and prints summary lines to stdout; there is no HTML generation, templating, or visualization logic.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    97% confidence
    Finding

    The argparse description/help strings and runtime status/error messages are all presented only in Chinese. Because these are direct user-facing interface strings, they impose a single language choice without offering an alternative or documenting a justified locale-specific scope.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    94% confidence
    Finding

    Natural-language strings throughout the script, including the CLI description, labels, and generated HTML, are fixed to Chinese and the HTML is explicitly tagged as zh-CN. The policy requires avoiding forced language or locale constraints unless the user is given a choice or the constraint is clearly documented as justified.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Low
    Category
    Not specified by scanner
    Confidence
    85% confidence
    Finding

    This code performs a file write to the user-specified output path, but the only user-facing disclosure comes after the write completes. Under the code-file warning criteria, there is no confirmation prompt, pre-write notice, or inline comment/docstring specifically warning that a local HTML file will be created or overwritten.

    Content

    No source excerpt is available for this finding.

    Static analysis

    No suspicious patterns detected.