Back to skill

Security audit

电力交易96点转24点

Security checks for vulnerabilities and agentic risk

Overview

This is a narrow Excel conversion skill for power-trading spreadsheets, with a real spreadsheet-safety caveat but no evidence of hidden, persistent, or unrelated behavior.

Install only if you need this specific Excel 96-to-24 power-trading workflow. Use trusted source workbooks when possible, review generated formulas before sharing outputs, and be cautious opening converted files from attacker-supplied spreadsheets in Excel or similar software.

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/convert_96_to_24.py:51
Finding

Workbook Formula Injection Through Unsanitized Cell Copying

Content
View full analysis

Vulnerability Details

File Location: scripts/convert_96_to_24.py, lines 51-54
Vulnerability Type: Spreadsheet formula injection
Risk Level: Medium

python
def copy_sheet_data(src_ws, dst_ws):
    for r in range(1, src_ws.max_row + 1):
        for c in range(1, src_ws.max_column + 1):
            dst_ws.cell(r, c, src_ws.cell(r, c).value)

The vulnerable function is invoked when constructing the output workbook:

python
copy_sheet_data(src_ws, ws96)

Technical Analysis

The function copies values from a potentially untrusted source workbook into newly created cells without validating formula-control prefixes or explicitly preserving values as text. When openpyxl receives a string beginning with =, it may assign the destination cell a formula data type rather than a literal string.

Consequently, attacker-controlled text from the input workbook can become an active formula in the generated source96 worksheet. Loading the source workbook with data_only=True does not fully prevent this condition: although it reads cached values for cells already represented as formulas, a deliberately supplied text cell whose content begins with a formula marker can still be reassigned as a formula when written to the destination workbook.

Formula execution depends on the spreadsheet client and its security configuration. Potential payloads include references to external resources, deceptive hyperlinks, data manipulation, and other spreadsheet-supported operations. This finding does not establish arbitrary operating-system command execution by the Python process itself.

Attack Path

  1. An attacker prepares an XLSX workbook containing the expected headers and 96 non-empty data rows so that it passes source-sheet validation.
  2. The attacker places a text value beginning with a spreadsheet formula marker, particularly =, in a copied cell such as the time column.
  3. A user runs the conversion scri ...[truncated 1282 chars]
Remediation
View remediation

Remediation Suggestions

Treat all copied workbook content as untrusted and distinguish literal text from trusted formulas before assigning values to destination cells.

  1. Neutralize text beginning with spreadsheet control prefixes such as =, +, -, or @ when formulas are not expected. For example, prefix such values with an apostrophe so spreadsheet applications render them as literal text.
  2. Preserve the source cell's intended data type explicitly rather than relying only on value reassignment. Do not convert source text into formulas implicitly.
  3. Permit formulas only in cells generated from fixed, application-controlled formula templates, such as those written to formula24.
  4. Validate source headers, time labels, and data columns against expected types. Numeric metric columns should reject strings and formulas rather than copying or averaging them.
  5. Add regression tests using text values such as =1+1, +SUM(1,1), -1+2, and @SUM(1,1). Confirm that copied cells remain literal text and are not saved with a formula data type.
  6. Consider rejecting input workbooks containing unexpected formulas or formula-like text when the intended input format is strictly numeric.

A defensive helper can be used when copying text:

python
def safe_excel_value(value):
    if isinstance(value, str) and value.startswith(("=", "+", "-", "@")):
        return "'" + value
    return value

Apply this helper to untrusted values before assigning them to destination cells. If negative numeric strings are valid input, validation should first distinguish properly parsed numeric values from arbitrary text so legitimate data is not unnecessarily altered.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description defines invocation examples only in Chinese, such as “96转24” and “日前96点边界条件汇总,” which creates an implicit language requirement for activation. The file does not state that the skill is China-specific or otherwise justify the locale constraint, nor does it offer an opt-in or alternative language phrasing.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.