Back to skill

Security audit

生成导入模板数据

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently inspects user-provided spreadsheet templates and helps generate matching import data, with no hidden network, persistence, credential, or destructive behavior found.

Install only if you want an agent to inspect uploaded spreadsheet templates and generate synthetic import rows from them. Use reasonable-size templates from trusted sources, and review generated data and inferred mappings before importing into a real system, especially for non-Chinese or non-English templates.

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

Warning
Location
scripts/inspect_template.py:49
Finding

Unbounded Parsing of Untrusted Spreadsheet Files

Content
View full analysis

Vulnerability Details

File Location: scripts/inspect_template.py:49, 65, 81-87, 119-124
Vulnerability Type: Uncontrolled Resource Consumption
Risk Level: Medium

Vulnerable Code

python
def detect_header(rows: Iterable[list[str]]) -> tuple[int | None, list[str], list[list[str]]]:
    buffered = [row for row in rows]
python
def inspect_csv(path: Path, delimiter: str) -> dict[str, object]:
    with path.open("r", encoding="utf-8-sig", newline="") as handle:
        reader = csv.reader(handle, delimiter=delimiter)
        rows = [[normalize_cell(cell) for cell in row] for row in reader]
python
def iter_ws_rows(worksheet) -> list[list[str]]:
    rows: list[list[str]] = []
    for row in worksheet.iter_rows(values_only=True):
        normalized = [normalize_cell(cell) for cell in row]
        if any(normalized):
            rows.append(normalized)
    return rows
python
for row_index in range(worksheet.nrows):
    row = [
        normalize_cell(worksheet.cell_value(row_index, col_index))
        for col_index in range(worksheet.ncols)
    ]
    if any(row):
        rows.append(row)

Technical Analysis

The inspection script accepts user-provided CSV, TSV, XLS, XLSX, and XLSM files but imposes no limits on input size, worksheet count, row count, column count, cell length, or compressed workbook expansion.

Every CSV row is loaded into a list before header detection. Excel paths similarly materialize all non-empty cells from each selected sheet. detect_header() then creates another list from its input, although it ultimately examines only the first 15 rows and returns at most three sample rows.

Consequently, a specially constructed or simply oversized template can cause excessive memory allocation and CPU use. Compressed Office files may amplify the problem when a relatively small archive expands into a very large worksheet representation.

Attack Path

  1. An attacker creates an oversized CSV or spreadshee ...[truncated 884 chars]
Remediation
View remediation

Remediation Suggestions

  1. Reject inputs exceeding a configured byte-size limit before invoking spreadsheet parsers.
  2. For XLSX and XLSM files, inspect ZIP metadata and enforce limits on entry count, individual uncompressed entry size, total uncompressed size, and compression ratio.
  3. Limit the number of worksheets, rows, columns, and characters per cell processed.
  4. Stream CSV and TSV records rather than materializing the complete file. Stop after collecting enough rows for header detection and preview generation.
  5. Modify workbook inspection to stop after a bounded number of rows because header detection only requires the first 15 candidate rows and three preview rows.
  6. Avoid redundant buffering in detect_header() by accepting an already bounded sequence or consuming only the required number of records.
  7. Run parsing in an isolated worker with explicit memory, CPU, and execution-time limits.
  8. Return a controlled error when any limit is exceeded rather than continuing partial or unbounded processing.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared purpose centers on creating import-ready data from uploaded templates. However, the provided script is an analyzer: it reads spreadsheet files, identifies likely headers, extracts a few sample rows, ranks sheets, and prints a JSON summary. There is no logic for generating, fabricating, filling, or exporting import data based on a business scenario. While inspecting templates could be a supporting step for generation, this code chunk’s primary function is materially different from the declared purpose, so this is a mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest presents the skill name entirely in Chinese, which indicates a fixed language choice without offering the user any language or locale option. This can violate language/locale policy when the skill is not clearly documented as region-specific or opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The heuristics explicitly prioritize Chinese and English field suffixes such as 编码, 编号, 名称, Date, and Time, which creates an implicit language/locale bias in how the skill interprets schemas. The file does not state that the skill is limited to bilingual datasets or offer any user opt-in for other languages, so this can violate the language/locale policy criterion.

Content

No source excerpt is available for this finding.