Back to skill

Security audit

excel-toolkit

Security checks for vulnerabilities and agentic risk

Overview

This Excel skill is mostly purpose-aligned, but it has an unsafe file-splitting function that can write spreadsheet output outside the chosen folder based on workbook cell contents.

Review this skill before installing if you expect to process untrusted spreadsheets or CSVs. Use copies of important workbooks, avoid split_by_column on attacker-controlled data until filenames are sanitized, and be cautious opening XLSX files generated from untrusted CSV content because formula-like cells may remain active.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
excel_parser.py:237
Finding

Path Traversal and Arbitrary XLSX File Write in Column-Based Split Operation

Content
View full analysis

Vulnerability Details

File Location: excel_parser.py:237-252
Vulnerability Type: Untrusted spreadsheet data used in an output file path
Risk Level: High

python
@staticmethod
def split_by_column(input_path: str, output_dir: str, column: str):
    """按列拆分Excel"""
    if not PANDAS_AVAILABLE:
        raise ImportError('pandas not installed')
    
    df = pd.read_excel(input_path)
    
    os.makedirs(output_dir, exist_ok=True)
    
    for value, group in df.groupby(column):
        filename = os.path.join(output_dir, f'{value}.xlsx')
        group.to_excel(filename, index=False)
    
    return output_dir

Technical Analysis

The values in the attacker-influenced grouping column are inserted directly into output filenames. The implementation does not reject absolute paths, parent-directory components such as .., or path separators.

As a result, a grouping value such as ../target produces a path similar to output_dir/../target.xlsx. If an absolute grouping value is accepted, os.path.join() can also discard the intended output directory. The subsequent group.to_excel() call creates or overwrites the resolved file without checking whether it remains inside output_dir.

Exploitation requires the attacker to control a workbook processed by split_by_column() and the process to have write permission at the resolved destination.

Attack Path

  1. An attacker creates an XLSX workbook containing the expected grouping column.
  2. A row in that column is assigned a traversal-oriented value such as ../target.
  3. A user or automated workflow invokes ExcelParser.split_by_column() on the workbook.
  4. The grouping value is interpolated into f'{value}.xlsx'.
  5. os.path.join() resolves the constructed path outside the intended output directory.
  6. group.to_excel() creates or overwrites the resulting XLSX file using the privileges of the running process.

Impac

...[truncated 458 chars]

Remediation
View remediation

Remediation Suggestions

  • Never use spreadsheet values directly as filenames.
  • Convert values to a controlled filename representation and reject absolute paths, .., /, \, drive prefixes, control characters, and platform-specific reserved names.
  • Resolve both the output directory and candidate path to canonical absolute paths, then verify that the candidate is a descendant of the output directory.
  • Generate opaque filenames, such as UUIDs or numeric sequence identifiers, and maintain a separate mapping to the original grouping values.
  • Apply an explicit overwrite policy. Refuse to replace existing files unless replacement was deliberately requested.
  • Add tests covering parent traversal, absolute paths, Windows drive and UNC paths, embedded separators, reserved filenames, and filename collisions.

T09 · Insecure Skill Coding Practices

Warning
Location
excel_parser.py:281
Finding

Spreadsheet Formula Injection During CSV-to-XLSX Conversion

Content
View full analysis

Vulnerability Details

File Location: excel_parser.py:281-294
Vulnerability Type: Untrusted CSV content exported as active spreadsheet formulas
Risk Level: Medium

python
def csv_to_excel(csv_path: str, excel_path: str = None, sheet_name: str = 'Sheet1'):
    """CSV转Excel"""
    if not PANDAS_AVAILABLE:
        raise ImportError('pandas not installed')
    
    df = pd.read_csv(csv_path)
    
    if excel_path is None:
        excel_path = os.path.splitext(csv_path)[0] + '.xlsx'
    
    df.to_excel(excel_path, sheet_name=sheet_name, index=False)
    return excel_path

Technical Analysis

The conversion function reads attacker-controlled CSV fields and writes them into an XLSX workbook without distinguishing literal text from spreadsheet formulas. In relevant XLSX writer paths, a string beginning with = can be stored as a formula rather than inert text.

This is a spreadsheet formula injection vulnerability. The payload is not executed by Python during conversion; it becomes active when a user opens or recalculates the generated workbook in a compatible spreadsheet application. The exact consequences depend on the spreadsheet client, its security settings, and the formula functions it supports.

Attack Path

  1. An attacker supplies a CSV file containing a field beginning with = and an attacker-selected formula.
  2. A user or automated service calls csv_to_excel() with that CSV file.
  3. pandas.read_csv() preserves the field as string data.
  4. DataFrame.to_excel() exports the field without neutralizing formula syntax.
  5. A victim opens the generated workbook in Excel or another compatible spreadsheet client.
  6. The client interprets or recalculates the field as a formula.
  7. Depending on client capabilities and security policy, the formula may initiate an external request, expose workbook-derived data, mislead the user, or trigger other formula-supported behavior.

...[truncated 579 chars]

Remediation
View remediation

Remediation Suggestions

  • Treat imported CSV fields as untrusted literal text by default.
  • Before export, detect strings beginning with formula-significant characters, particularly =, and escape or neutralize them according to the selected XLSX writer's behavior.
  • Preserve the original value as text by explicitly setting the destination cell's data type and text number format where appropriate.
  • If formula import is required, expose it as a clearly documented opt-in option rather than the default.
  • Warn users when formula-like fields are detected and report the affected rows and columns.
  • Add integration tests that inspect the generated workbook and verify that hostile formula strings are stored as text rather than formula cells.

T08 · Insecure Dependencies

Note
Location
requirements.txt:1
Finding

Unpinned Third-Party Dependencies Create Non-Reproducible Installations

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-2
Vulnerability Type: Unconstrained third-party dependency resolution
Risk Level: Low

text
openpyxl
pandas

Technical Analysis

Both dependencies are declared without exact versions, compatible version ranges, lockfile state, or integrity hashes. Each installation can therefore resolve to a different release based on the package index state at installation time.

The reviewed dependency names are not evidence of typosquatting or an intentionally malicious package. The risk arises from mutable, non-reproducible dependency resolution: future compromised, vulnerable, or incompatible releases could be consumed without a corresponding review of this project.

Attack Path

  1. A deployment installs dependencies from requirements.txt.
  2. The package resolver selects whatever versions currently satisfy the unconstrained names.
  3. A selected version may differ from the version originally tested or reviewed.
  4. Package installation or later import executes code from that newly resolved release.
  5. Any vulnerability or supply-chain compromise in that release is inherited by the Skill's execution environment.

This is a supply-chain hardening weakness rather than evidence that the currently named packages are malicious.

Impact Assessment

Potential impact depends entirely on the defect or compromise introduced by a resolved dependency release. Because these libraries execute in the same Python process as the Skill, a compromised dependency could theoretically access files and resources available to that process. More commonly, unconstrained upgrades may cause availability failures, data corruption, or unexpected workbook-processing behavior.

Remediation
View remediation

Remediation Suggestions

  • Pin dependencies to versions that have been reviewed and tested, for example through a generated lockfile.
  • Use hashes for deployed artifacts, such as pip's --require-hashes workflow.
  • Separate direct dependencies from fully resolved transitive dependencies.
  • Run automated vulnerability and license checks against the locked dependency set.
  • Establish a controlled update process that reviews release notes, reruns security checks, and executes workbook compatibility tests before changing pinned versions.
  • Install packages only from an approved package index over authenticated TLS.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The code is broadly aligned with an Excel manipulation purpose, so there is no hidden unrelated or suspicious behavior. However, the declared description overstates several capabilities. The implementation mainly supports .xlsx-style workflows through openpyxl and pandas, plus CSV conversion. It does not implement TSV handling, does not provide .xls-specific support, and does not include mechanisms for recalculation management, robust preservation of workbook structure/templates, or explicit reliable handling of dates/types beyond what underlying libraries do by default. The description also suggests strong compatibility and preservation guarantees that the code does not substantiate, especially for .xlsm/macros and template preservation. Therefore this is a description-to-behavior mismatch due to materially over-declared capabilities.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README documents operations such as write_cell, write_row, append_row, create_sheet, and delete_sheet without warning that they can overwrite or destroy existing workbook data. In an agent-operated environment, missing safety guidance increases the chance of accidental destructive actions against user files, especially when the skill is trusted to preserve workbook integrity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The README describes XLSX-to-CSV conversion and file merge operations without warning that output paths may overwrite existing files or produce lossy transformations. This is dangerous because users or agents may unintentionally destroy prior outputs, merge sensitive data into a single file, or lose formulas/formatting during conversion without notice.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README for an Excel/XLSX skill advertises imports and use of broader workflow, charting, parsing, database, and Feishu Sheets modules that exceed the declared scope. In an agent skill context, scope expansion is dangerous because it can cause the orchestrator or user to invoke unexpected capabilities, increasing the attack surface and enabling unintended data movement or side effects.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation explicitly references database and external sheet integration capabilities that are not justified by the skill's Excel file editing purpose. In a security-sensitive agent environment, this mismatch can mislead users or routing logic into granting broader trust to a skill that may access external systems or move data beyond local workbook operations.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 89)May include surrounding context.

md
- Dynamic array or newer Excel functions like `FILTER`, `XLOOKUP`, `SORT`, or `SEQUENCE` may fail or degrade in older viewers.
- A workbook can look fine while still carrying stale cached values from a prior recalculation.
- Saving the wrong workbook view can replace formulas with cached values and quietly destroy a live model.
- Copying formulas without checking relative references can push one bad range across an entire block.
- Hidden sheets, named ranges, validations, and merged areas often keep business logic that is invisible in a quick skim.
- A workbook can appear numerically correct while still failing because filters, conditional formats, print settings, or data validation were stripped.
- A workbook can be numerically correct and still fail visually because wrapped text, clipped labels, or narrow columns were never reviewed.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

Most of the explanatory and instructional text is presented only in Chinese, while the file does not state that the skill is intended solely for a Chinese-speaking audience or provide an opt-in language choice. This can violate a language/locale policy when a skill implicitly forces one language for users without justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

文件名和标题均表明该技能文档以中文为唯一呈现语言,但文档中没有说明这是可选语言版本,也没有提供用户语言偏好或其他语言入口。按规则,未获用户选择即强制特定语言属于自然语言层面的政策风险。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown includes Chinese-only instructional text such as "Python实现", "读取", and "写入" in the code implementation section. That imposes a specific language in user-facing documentation without any opt-in or documented reason, which is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The top-level natural-language description presents the skill in Chinese and English but does not state any language-selection policy or user opt-in. Under the language/locale policy criterion, this can be read as imposing presentation choices without explicitly offering the user control over language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The delete_sheet method removes a worksheet from the workbook, which is a destructive operation affecting user data. While the method name is descriptive for developers, the file contains no confirmation prompt, user-visible logging, or explicit warning comment/docstring about the data-loss impact of deletion.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency on openpyxl is unpinned, so builds may resolve to different versions over time, including versions with known security flaws or breaking changes. In a skill that parses and edits Excel files, dependency drift is security-relevant because hostile spreadsheet inputs may exercise vulnerable parsing paths in whichever version gets installed.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
openpyxl
pandas

Unverifiable Dependency: openpyxl has 2 known advisory(ies) (CVE-2017-5992 (Improper Restriction of XML External Entity Reference in Openpyxl); CVE-2017-5992 (Openpyxl 2.4.1 resolves external entities by default, which allows remote attack)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
88% confidence
Finding

The manifest does not pin openpyxl, so it is impossible to verify whether deployment will use a release affected by known XXE-related advisories. This is more concerning in an Excel-processing skill because it is expected to open untrusted workbook content, and XML-based spreadsheet parsing can be an attack surface if an affected version is installed.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The pandas dependency is also unpinned, which makes the runtime version unverifiable and non-reproducible. Because this skill handles spreadsheet and tabular file formats, an unexpected or vulnerable pandas release could expose parsing or deserialization-related risk depending on how the library is used elsewhere in the skill.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
openpyxl
pandas

Unverifiable Dependency: pandas has 1 known advisory(ies) (CVE-2020-13091 (** DISPUTED ** pandas through 1.0.3 can unserialize and execute commands from an)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
75% confidence
Finding

Because pandas is unpinned, the installed version may be an affected release, and the manifest gives no way to verify that a safe version will be used. The cited advisory is disputed and often depends on unsafe application behavior such as loading untrusted serialized data, so the direct risk from this file alone is limited, but the uncertainty remains a supply-chain weakness.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.