Back to skill

Security audit

供应商来料质量专项分析

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its stated reporting purpose, but its generated HTML reports can execute spreadsheet-supplied markup and its report filename prefix can write outside the intended output folder.

Review this skill before installing if it will process workbooks from suppliers or other untrusted parties. Open generated HTML reports cautiously, prefer Markdown or sanitized HTML output, and choose a controlled output directory and simple filename prefix. The artifacts do not show network exfiltration, persistence beyond report files, or hidden installation behavior.

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

T09 · Insecure Skill Coding Practices

Error
Location
assets/report-template.html:570
Finding

Stored HTML and Script Injection in Generated Reports

Content
View full analysis
0 else 0 }) ``` ```python conclusions = [] conclusions.append(f"本次分析共涵盖{len(supplier_summary)}家供应商,{total_batches}批次来料数据") conclusions.append(f"整体批次合格率为{batch_pass_rate:.2f}%,来料不良PPM为{ppm:.2f}") if ppm > 2000: conclusions.append(f"不良率偏高,PPM达到{ppm:.2f},建议重点关注不良TOP1项:{defect_type_top[0]['defect_type'] if defect_type_top else '无'}") else: conclusions.append(f"整体质量良好,PPM控制在{ppm:.2f},符合质量要求") if defect_type_top: top_defect = defect_type_top[0] conclusions.append(f"主要不良类型为'{top_defect['defect_type']}',占比{top_defect['percentage']:.2f}%,建议供应商针对性改善") if len(supplier_summary) > 1: worst_supplier = supplier_comparison[-1]['supplier'] conclusions.append(f"多供应商对标中,'{worst_supplier}'综合表现最差,建议重点跟进并约谈改善") ``` The report generator uses a Jinja template without enabling HTML autoescaping: ```python def generate_html(self): """生成HTML格式报告""" template_path = Path(__file__).parent.parent / "assets" / "report-template.html" try: with open(template_path, 'r', encoding='utf-8') as f: template_content = f.read() except FileNotFoundError: # 如果模板不存在,使用内置模板 template_content = self._get_builtin_template() template = Template(template_content) html_content = template.render(**self.data) return html_content ``` The primary and fallback t ...[truncated 2570 chars]
Remediation
View remediation
{{ conclusion }} ``` 3. Do not embed presentation markup inside conclusion strings. Represent emphasis as structured data: ```python { "severity": "warning", "message": f"Defect PPM is {ppm:.2f}." } ``` The template can then select a trusted CSS class based on a fixed allowlist while escaping the message. 4. If limited user-supplied HTML is an explicit requirement, sanitize it with a mature allowlist sanitizer before rendering. Permit only necessary formatting tags and attributes; reject scripts, event handlers, URLs, inline styles, SVG, and embedded objects. 5. Add regression tests using payloads in supplier, defect-type, and inspection-item fields, including: ```html "> ``` The generated HTML must contain escaped text rather than executable elements. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_report.py:176
Finding

Output Directory Escape Through Unvalidated Report Prefix

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill instructs the agent to invoke local scripts that read user-supplied Excel files and generate report outputs, but the manifest declares no explicit tool scope or permission boundaries. This creates an authorization gap where file read/write behavior exists without documented restrictions, increasing the risk of over-broad filesystem access, unsafe path handling, or unintended access to sensitive local files when processing attacker-controlled paths.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The TRACE section states the skill 'supports Chinese interaction', and the document provides no indication that other languages are supported or that the user can opt into a preferred language. This creates a natural-language locale constraint without explicit user choice or a documented justification as a region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The HTML root element explicitly sets the document language to zh-CN, which imposes a specific locale. Under the policy, forcing a language or locale without user opt-in is a natural-language policy violation unless the constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The document title and all user-facing examples/instructions are entirely in Chinese, indicating the skill documentation enforces a specific language/locale. There is no note offering alternative languages, user opt-in, or a documented regional justification, which fits the policy category for forced language without user choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file contains user-facing natural-language descriptions entirely in Chinese, including the module docstring and later CLI/help strings, with no indication that users can choose another language. Under the policy rule for language/locale constraints, forcing a specific language without opt-in is a natural-language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Natural-language strings, report titles, section headings, CLI descriptions, and the HTML locale are all fixed to Chinese/zh-CN. There is no indication that the user can opt into another language or that this locale restriction is required for a region-specific compliance or business context.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

generate_markdown 在 L33-L41 从 self.data['summary'] 读取 supplier_count、total_batches、ppm 等字段,而内置HTML模板在 L151-L161 直接使用 {{supplier_count}}、{{total_batches}}、{{ppm}}。这会导致当输入遵循同一脚本前半部分所暗示的数据结构时,备用HTML模板无法正确呈现报告内容,属于代码内文档化模板意图与实际实现的数据契约相矛盾。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code generates Markdown and HTML files containing supplier quality analysis data and writes them to the local filesystem. While it prints success messages after writing, there is no prior disclosure in comments, docstrings, or prompts that the script will persist potentially sensitive business data to files in the chosen output directory.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.