Back to skill

Security audit

电商主图详情页诊断

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent ecommerce report workflow, but its generated HTML report can turn untrusted product or user text into active browser content.

Review before installing. Use this only with product data and diagnosis text you trust, and avoid opening or sharing generated HTML reports from untrusted inputs until the generator escapes HTML and validates URLs.

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/generate_report.py:89
Finding

Stored HTML and JavaScript Injection in Generated Reports

Content
View full analysis
暂无" color = "#993C1D" if tag_type == "issue" else "#27500A" bg = "#FAECE7" if tag_type == "issue" else "#EAF3DE" html = "" for item in items: html += f'{item}' return html ``` ```python def render_priority_list(items, p_level): if not items: return f'

暂无 {p_level} 级问题

' color_map = {"P0": "#E24B4A", "P1": "#BA7517", "P2": "#378ADD"} bg_map = {"P0": "#FCEBEB", "P1": "#FAEEDA", "P2": "#E6F1FB"} color = color_map.get(p_level, "#378ADD") bg = bg_map.get(p_level, "#E6F1FB") html = "" for i, item in enumerate(items, 1): html += f"""
{p_level} {item}
""" return html ``` ```python # key findings key_findings = data.get("key_findings", []) findings_html = "" for f in key_findings: findings_html += f'
  • {f}
  • ' if not findings_html: findings_html = '
  • 暂无核心发现
  • ' ``` ```python sc_html = f"""
    Remediation
    View remediation
    ' f'{safe_value}' ) ``` Reject or render as plain text URLs using `javascript:`, `data:`, `file:`, or other unexpected schemes. 3. Enforce a strict input schema before report generation. Validate: - Expected object, array, string, and numeric types. - Score and maximum-score ranges. - Maximum string and array lengths. - Allowed grade, platform, and competition values. - URL format and scheme. 4. Keep text and markup generation separate. Prefer a template engine with automatic escaping enabled rather than constructing HTML through raw f-string interpolation. 5. Add a restrictive Content Security Policy as defense in depth, for example: ```html ``` The policy should be tested against the report's legitimate functionality. It must supplement, not replace, correct escaping and validation. 6. Add regression tests using payloads such as: ```text
    Vulnerability Patterns
    • 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
    • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
    • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
    Findings (7)

    Undeclared Tool Scope

    Medium
    Category
    MCP Least Privilege
    Confidence
    91% confidence
    Finding

    The skill instructs the agent to write a JSON file, generate an HTML report, and present local files, but it declares no explicit tool scope or permissions. This creates a mismatch between documented behavior and security boundaries, increasing the risk of unintended file-system access or execution through implicitly available tools.

    Content

    No source excerpt is available for this finding.

    Vague Triggers

    Medium
    Category
    Not specified by scanner
    Confidence
    96% confidence
    Finding

    The manifest description advertises many vague trigger phrases that overlap with normal conversation, which increases the chance the skill is invoked unintentionally. In this skill, accidental invocation is more risky because activation may lead to automatic product-link fetching and local HTML report generation without a clearly disclosed consent step.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    93% confidence
    Finding

    The skill states that a product link can be provided and that the skill may automatically fetch product information and generate local report files, but this side effect is not clearly disclosed in the user-facing description. Users may share links expecting advice only, while the skill performs network-style retrieval and writes artifacts to disk, which has privacy, consent, and local side-effect implications.

    Content

    No source excerpt is available for this finding.

    Vague Triggers

    Medium
    Category
    Not specified by scanner
    Confidence
    94% confidence
    Finding

    The trigger conditions are broad enough to activate on ordinary ecommerce help requests, image uploads, or generic words like '分析' and '优化'. Over-triggering can cause the agent to initiate link handling, image analysis, or report-generation workflows the user did not clearly request, leading to unintended processing and file creation.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    This markdown file presents the skill framework entirely in Chinese, starting with the title and continuing throughout the document. Under the policy rule, forcing a specific language without user opt-in or a documented justification is a natural-language policy violation.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    98% confidence
    Finding

    The script renders a full HTML report by directly interpolating untrusted JSON fields such as product_name, product_url, notes, findings, issues, and suggestions into HTML and attribute contexts without escaping. If an attacker controls the diagnosis JSON, they can inject script, malicious links, or active HTML into the generated file, leading to stored client-side code execution when the report is opened locally or hosted, and the file-write step persists the payload to disk.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Low
    Category
    Not specified by scanner
    Confidence
    92% confidence
    Finding

    The HTML output hard-codes lang="zh-CN", and the surrounding user-facing text is also fixed in Chinese. The policy requires avoiding forced language or locale constraints unless the user is given a choice or the restriction is clearly documented and justified.

    Content

    No source excerpt is available for this finding.

    Static analysis

    No suspicious patterns detected.