Back to skill

Security audit

customer-segment

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to be a legitimate local customer-segmentation tool, but it persists sensitive banking customer data more broadly than described and lacks safeguards around generated CSV outputs.

Review before installing or using with real customer data. Use a dedicated output directory, avoid processing production or personally identifiable banking records unless permitted, and treat generated CSV files as sensitive. The publisher should add confirmation before processing, minimize exported fields, mask identifiers, sanitize spreadsheet formula-leading values, and document that only CSV input is currently supported.

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/segment.py:297
Finding

Spreadsheet Formula Injection in Exported Segmentation Results

Content
View full analysis

Vulnerability Details

File Location: scripts/segment.py, lines 297-298
Vulnerability Type: CSV/spreadsheet formula injection
Risk Level: Medium
Classification: T09: Insecure Skill Coding Practices

Vulnerable Code

python
out_csv = os.path.join(output_dir, 'segmentation_results.csv')
df.to_csv(out_csv, index=False, encoding='utf-8-sig')

Technical Analysis

The script reads an attacker-supplied CSV into a pandas DataFrame and later exports the complete DataFrame without sanitizing text cells. This includes unrecognized columns and other attacker-controlled string values retained from the source file.

Spreadsheet applications may interpret cells beginning with formula-significant characters such as =, +, -, or @ as formulas rather than plain text. The UTF-8 BOM encoding does not prevent this behavior.

An attacker could therefore place a spreadsheet formula in an input field that is preserved in segmentation_results.csv. When an analyst opens the generated file in compatible spreadsheet software, the application may evaluate the formula. Actual behavior depends on the spreadsheet product, its version, security configuration, and user interaction.

Attack Path

  1. An attacker creates or modifies a customer CSV record so that a retained text field begins with a formula-significant character, for example a formula that references an external resource.
  2. The analyst processes the file with scripts/segment.py.
  3. load_and_clean() preserves the attacker-controlled field in the DataFrame.
  4. The script exports the complete DataFrame to segmentation_results.csv without neutralizing formula-leading values.
  5. The analyst opens the generated CSV in spreadsheet software.
  6. If formula evaluation or external content is permitted, the spreadsheet application evaluates the payload in the analyst's user context.

Impact Assessment

Successful exploitation may cause the sp ...[truncated 571 chars]

Remediation
View remediation

Remediation Suggestions

Sanitize every user-controlled string cell before CSV export. At minimum, detect values whose first non-whitespace character is =, +, -, or @ and prefix them with an apostrophe or another application-appropriate text marker.

Apply the protection to all exported text columns rather than only recognized customer fields, because unknown input columns are currently preserved.

Example hardening approach:

python
def neutralize_spreadsheet_formula(value):
    if not isinstance(value, str):
        return value

    stripped = value.lstrip()
    if stripped.startswith(('=', '+', '-', '@')):
        return "'" + value

    return value

safe_df = df.copy()
text_columns = safe_df.select_dtypes(include=['object', 'string']).columns

for column in text_columns:
    safe_df[column] = safe_df[column].map(neutralize_spreadsheet_formula)

out_csv = os.path.join(output_dir, 'segmentation_results.csv')
safe_df.to_csv(out_csv, index=False, encoding='utf-8-sig')

Also consider exporting to a format that supports explicit text cell types, validating the accepted input schema, discarding unnecessary columns, and documenting that generated CSV files should be opened with external links and automatic formula execution disabled.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The core analytic purpose mostly matches: the code does customer segmentation, feature extraction, visualization, and report generation for banking-style customer data. However, the declared description materially overstates how the skill operates. It claims automatic triggering on user requests or uploaded CSV/Excel files, but the provided code contains no trigger-handling logic at all and is only a command-line script. It also claims CSV/Excel support, while the implementation only loads CSV using pd.read_csv and has no Excel parsing path. There are no suspicious undeclared exfiltration or unrelated capabilities; the mismatch is primarily between the described interface/trigger/file-format support and the actual implementation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill writes multiple output files (segmentation_results.csv, cluster_summary.csv, segmentation_charts.png, segmentation_report.md) but does not declare any explicit tool scope or file-write permissions. In a banking-data context, undeclared write capability increases the risk of uncontrolled persistence of sensitive customer data and makes operator review and sandboxing harder.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger phrase 分析客户 is broad enough to match ordinary discussion, which can cause the skill to auto-activate on unintended conversations. In this skill, accidental activation is more dangerous because it is designed to process uploaded bank customer data and generate persisted outputs, potentially causing unauthorized handling of sensitive financial information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is explicitly intended for uploaded bank customer datasets and produces multiple output files, yet it gives no user-facing warning about sensitive financial and customer information handling. This can lead to unintentional exposure, retention, or redistribution of personal and financial data through generated artifacts and local storage.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Natural-language policy checks apply to all file types, including markdown and embedded code snippets. The description and workflow are written as if the skill operates in Chinese by default, and the plotting configuration hard-codes Chinese fonts, but there is no opt-in or documented locale restriction justifying a Chinese-only experience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script’s natural-language interface is hard-coded in Chinese, including the module description and usage text. This enforces a specific language/locale for users without any opt-in or documented regional justification, which matches the policy-violation criteria for language constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file title and all instructional content are written exclusively in Chinese, with no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the policy rule for natural-language violations, this can be considered a locale/language constraint without explicit opt-in or justification.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.