Back to skill

Security audit

forecast-analysis-claw

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local sales forecasting and replenishment helper with some overstated documentation and CSV-handling risks, but no evidence of hidden execution, exfiltration, persistence, or destructive behavior.

Install only in an isolated Python environment and treat input sales spreadsheets as sensitive business data. Be careful opening generated CSV files from untrusted source data in spreadsheet software, and review results manually because promotion forecasting and pushed stockout alerts are mostly documented guidance rather than implemented automation.

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

Warning
Location
scripts/data-cleaner.py:81
Finding

Spreadsheet Formula Injection in Generated CSV Files

Content
View full analysis

Vulnerability Details

File Location: scripts/data-cleaner.py:81, scripts/data-cleaner.py:120, and scripts/forecast-runner.py:247-254
Vulnerability Type: CSV/spreadsheet formula injection
Risk Level: Medium

Vulnerable Code

python
df.to_csv(output_path, index=False, encoding='utf-8-sig')
python
out_df.to_csv(args.output, index=False, encoding='utf-8-sig')
python
results.append({
    'sku': sku,
    **result,
})

out_df = pd.DataFrame(results)
output_path = args.output or 'forecast_result.csv'
out_df.to_csv(output_path, index=False, encoding='utf-8-sig')

Technical Analysis

Values originating from user-supplied CSV or spreadsheet files are written to output CSV files without neutralizing spreadsheet formula prefixes. In particular, attacker-controlled SKU values and string columns preserved by the cleaning operation can begin with characters such as =, +, -, or @.

CSV itself does not distinguish formulas from text. When a generated file is opened in Excel, LibreOffice Calc, or another spreadsheet application, such values may be interpreted as formulas rather than displayed as literal text. The exact behavior and available formula capabilities depend on the spreadsheet application and its security configuration.

The cleaner preserves input columns and writes them at line 81. The outlier report propagates the input SKU into a new data frame before writing it at line 120. The batch forecaster similarly copies each input SKU into the result data frame before exporting it at lines 247-254.

Attack Path

  1. An attacker creates a sales CSV or spreadsheet containing a formula-prefixed value in the sku column or another preserved string column.
  2. A user runs the clean, detect-outliers, or batch command against that file.
  3. The script copies the malicious value into an output CSV without escaping or type enforcement.
  4. The user or another re ...[truncated 840 chars]
Remediation
View remediation

Remediation Suggestions

  • Sanitize every string-valued cell before CSV export, not only the SKU column.
  • Prefix cells beginning with =, +, -, or @ with a single quote or another application-appropriate escape.
  • Consider tab, carriage-return, and line-feed prefixes that may allow a dangerous character to become the effective first spreadsheet character.
  • Prefer XLSX output with cells explicitly typed as text when the files are intended for spreadsheet consumption.
  • Preserve an unsanitized internal representation for calculations and apply neutralization only at the export boundary.
  • Add regression tests using values such as =1+1, +SUM(1,1), -1+2, and @SUM(1,1) and verify that spreadsheet applications display them as literal text.
  • Document that generated CSV files may contain untrusted source data and should not be opened before neutralization.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/data-cleaner.py:118
Finding

Terminal Escape-Sequence Injection Through Untrusted Data

Content
View full analysis

Vulnerability Details

File Location: scripts/data-cleaner.py:118, scripts/forecast-runner.py:256, and scripts/forecast-runner.py:274
Vulnerability Type: Terminal control-sequence injection
Risk Level: Low

Vulnerable Code

python
print(out_df.to_string(index=False))
python
print(out_df[['sku', 'daily_avg_forecast', 'total_forecast', 'model_used']].to_string(index=False))
python
print(merged[['sku', 'total_forecast', 'actual', 'mape']].to_string(index=False))

The report command also interpolates data-derived SKU values directly into terminal output at scripts/forecast-runner.py:291 and scripts/forecast-runner.py:295.

Technical Analysis

SKU values originate from user-selected CSV or spreadsheet files and are rendered directly to standard output. The code does not remove ANSI escape characters, OSC sequences, carriage returns, backspaces, or other terminal control characters.

A malicious value can therefore modify the presentation or behavior of a compatible terminal instead of appearing as ordinary text. Potential effects include clearing or overwriting visible output, creating misleading hyperlinks, changing terminal titles, forging apparent status messages, or attempting clipboard manipulation through terminal-specific OSC features.

No shell command is constructed from these values, so this is not operating-system command injection. The exposure is limited to terminal interpretation of untrusted control sequences.

Attack Path

  1. An attacker places ANSI or OSC terminal sequences in an input SKU value.
  2. A user processes the file with detect-outliers, batch, evaluate, or report.
  3. The data-derived value reaches one of the unescaped print calls.
  4. The interactive terminal interprets the embedded control bytes.
  5. The attacker-controlled sequence alters terminal presentation or invokes terminal-supported features.
  6. The user may be decei ...[truncated 577 chars]
Remediation
View remediation

Remediation Suggestions

  • Sanitize all data-derived strings before printing them to an interactive terminal.
  • Remove or visibly encode C0 and C1 control characters, especially the escape character \x1b.
  • Escape carriage returns, line feeds, backspaces, tabs, and bidirectional text-control characters when displaying identifiers.
  • Use a dedicated terminal-safe rendering function consistently across cleaning, batch, evaluation, and report commands.
  • Keep raw values in exported structured data only after applying the separate spreadsheet-injection protections described above.
  • Add tests containing ANSI color codes, OSC hyperlinks, terminal-title sequences, carriage returns, and embedded newlines.
  • When writing logs, use a structured serialization format that escapes control characters.

T08 · Insecure Dependencies

Note
Location
SKILL.md:125
Finding

Unpinned Third-Party Dependency Installation Instructions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:125-126 and references/forecast-models.md:38
Vulnerability Type: Unpinned dependency installation
Risk Level: Low

Vulnerable Code

bash
pip install pandas numpy scikit-learn
pip install prophet

The model reference also instructs users to install prophet without a version or integrity constraint.

Technical Analysis

The installation instructions resolve mutable package versions and transitive dependencies from the user's configured Python package index. No lock file, exact version constraints, or cryptographic hashes are supplied.

The package names shown are consistent with the documented forecasting libraries, and the reviewed project does not reference a suspicious package index or known typosquatted name. Consequently, this finding does not establish that a malicious dependency is currently present. It identifies a supply-chain hardening deficiency: future installations are not reproducible and automatically trust whichever releases and transitive dependencies are selected at installation time.

Because Python package installation can execute build-system code, compromise of an upstream release, dependency, package index, or local package-index configuration could affect the installing user.

Attack Path

  1. A user follows the documented unpinned pip install commands.
  2. Pip queries the package index configured in the user's environment.
  3. Pip resolves the currently available package releases and their transitive dependencies.
  4. A compromised, unexpectedly changed, or incompatible release is downloaded.
  5. Build hooks or installed package code executes with the privileges of the user performing installation or subsequently running the scripts.
  6. The resulting environment may be compromised or may produce behavior that differs from the version originally reviewed.

Impact Assessment

Potential impact is bounded by the pr ...[truncated 460 chars]

Remediation
View remediation

Remediation Suggestions

  • Provide a reviewed requirements.txt, lock file, or equivalent dependency manifest with exact versions.
  • Include hashes and install with pip install --require-hashes -r requirements.txt.
  • Pin transitive dependencies through a generated lock file rather than constraining only top-level packages.
  • Perform installations inside an isolated virtual environment and avoid administrator-level installation.
  • Use a trusted package index and explicitly document the expected index configuration.
  • Add automated dependency vulnerability and integrity scanning to the release process.
  • Periodically update pinned versions through a controlled review and testing process.
  • Keep optional dependencies such as Prophet in a separate locked dependency group so users do not install them unless required.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个需求预测与补货决策技能,重点在预测未来销量和生成库存建议;而代码仅提供数据预处理和异常检测功能。虽然数据清洗可作为预测流程的前置步骤,但这里它是唯一实现的核心功能,且没有任何预测、库存策略、活动系数、预警机制等逻辑。因此这是明显的描述与行为不一致,且代码的主要用途与声明的主要用途 materially different。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

整体上,代码的核心用途与声明大体相关,确实是在做销量预测和补货计算。但声明中包含若干较强能力没有被实际实现,属于功能性夸大。具体而言:代码实现了移动平均、指数平滑和简化 Holt-Winters,另有 Prophet 函数但未暴露为命令行模型选项,也未纳入 auto 选择逻辑,因此“基于 Prophet 等模型自动预测”表述不准确。其次,声明提到“活动预测”“叠加促销效应系数预测大促期间销量峰值”,代码完全没有促销参数、活动因子、节假日/大促调整输入或峰值模拟逻辑。再次,声明提到“断货预警并推送预警”,而代码仅在单次计算中输出库存天数、优先级和建议补货量,没有检测后自动推送或告警通道。除此之外,evaluate 的示例命令与真实 CLI 参数也不一致,说明描述/文档与行为存在偏差。因此应判定为存在描述与行为不匹配。

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger conditions are broad and heavily keyword-based, covering generic terms like forecasting, replenishment, seasonality, historical data, and stock planning. In an agent environment, this can cause unintended invocation on loosely related user requests, increasing the chance the skill processes the wrong files or produces authoritative business guidance in contexts where it should not run.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

文件级文档明确将该脚本定位为“销售数据清洗脚本”,只提供 clean 和 detect-outliers 两个命令;代码中实际也仅执行读取表格、标准化列名、清洗日期/数量、去重、补零和基于均值/标准差的异常检测。与技能清单描述的核心能力相比,这里没有任何预测模型、补货点计算、促销效应建模或库存风险预警实现,说明该技能声明与实际代码行为存在明显不匹配。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings for the module description and usage that are exclusively in Chinese. Under the policy rule, forcing a specific language without offering a language choice or documenting a justified locale constraint is a violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file contains natural-language descriptions, usage text, and later user-facing messages exclusively in Chinese, which effectively forces a specific language on users. The policy allows locale constraints only when they are opt-in or clearly justified as region-specific, neither of which is stated here.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest states the skill can '叠加促销效应系数预测大促期间销量峰值', implying promotion-aware forecasting as a core capability. In code, although a Prophet helper exists, the main execution paths never accept promotion coefficients, holiday data, or invoke prophet_forecast; all CLI commands use forecast_sku, which only selects moving average, exponential smoothing, or Holt-Winters.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes '断货预警 - 识别高风险 SKU 并推送预警' as a core ability. The code computes a simple priority label during replenishment calculation and displays it in console/report output, but there is no mechanism to identify risk beyond this heuristic or to push/send alerts anywhere.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The natural-language content throughout the skill is presented exclusively in Chinese, and there is no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-speaking context. This can constitute a language/locale policy issue when a skill implicitly forces a language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file uses only Chinese-language headings and instructions throughout, which can constitute a language/locale policy issue when no user opt-in or justification is provided. The file does not indicate that the skill is region-specific or that users may choose another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The entire skill file is written in Chinese and provides no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module usage text says evaluate --input sales.csv --actual actual.csv, suggesting the evaluate subcommand accepts --input. However, the implemented parser and command handler require --forecast and --actual, and cmd_evaluate reads a forecast CSV rather than raw sales input.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module usage text documents report --forecast forecast_result.csv --inventory inventory.csv, implying the report command consumes inventory data. In the actual parser and implementation, report only accepts --forecast and never reads an inventory file.

Content

No source excerpt is available for this finding.