Back to skill

Security audit

仓配网络优化器

Security checks for vulnerabilities and agentic risk

Overview

This is a local warehouse-planning tool that reads user-provided logistics spreadsheets and writes local JSON/Excel reports, with no evidence of hidden persistence, credential access, or exfiltration.

Install in a virtual environment, pin dependency versions if using this in production, and treat generated Excel reports as untrusted when the source workbook or JSON data came from someone else. Validate the optimization assumptions and outputs before making warehouse or financial decisions.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
run_optimization.py:159
Finding

Formula Injection in Generated Excel Reports

Content
View full analysis

Vulnerability Details

File Location: run_optimization.py, lines 159-176 and 355-360
Vulnerability Type: Improper neutralization of formula-prefixed spreadsheet data
Risk Level: Medium

Vulnerable Code

Input values are read from an attacker-supplied Excel workbook without sanitization:

python
records = []
for idx, row in df.iterrows():
    province = str(row['省']) if pd.notna(row.get('省')) else None
    city = str(row['市']) if pd.notna(row.get('市')) else None
    district = str(row['区']) if pd.notna(row.get('区')) else '全区域'
    
    if not city:
        continue
    
    if not province or province == 'nan':
        province = city_to_province.get(city, city + '市')
    
    records.append({
        '省份': province,
        '城市': city,
        '区县': district,
    })

The values are subsequently written directly into the generated workbook:

python
ws3[f'A{row}'] = best_rdc['name']
ws3[f'B{row}'] = tc_name
ws3[f'C{row}'] = fsl_name
ws3[f'D{row}'] = province
ws3[f'E{row}'] = city
ws3[f'F{row}'] = district

Technical Analysis

The province, city, and district fields originate from the user-provided store workbook. No validation or formula neutralization is applied before these strings are assigned to cells in the output workbook.

In particular, OpenPyXL treats a string beginning with = as a formula when it is assigned to a cell. An attacker can therefore place a malicious formula in a source field and cause that formula to be preserved as active spreadsheet content in the generated report.

Depending on the spreadsheet application and its security configuration, malicious formulas can create deceptive hyperlinks, initiate requests to attacker-controlled resources, reference local or external workbooks, or attempt to disclose data available to the user opening the report. Exploitation ultimately depends on the report being opened in a spreadsheet applic ...[truncated 1610 chars]

Remediation
View remediation

Remediation Suggestions

Implement a centralized function that neutralizes untrusted spreadsheet text before assigning it to a cell:

python
def sanitize_excel_text(value):
    if value is None:
        return ''
    value = str(value)
    if value.startswith(('=', '+', '-', '@')):
        return "'" + value
    return value

Apply this function to every textual value originating from an input Excel file or replaceable JSON file:

python
ws3[f'D{row}'] = sanitize_excel_text(province)
ws3[f'E{row}'] = sanitize_excel_text(city)
ws3[f'F{row}'] = sanitize_excel_text(district)

Additional hardening measures should include:

  1. Validate province, city, and district fields against an expected character policy or trusted geographic dataset.
  2. Sanitize every untrusted string written to every worksheet, not only the three identified fields.
  3. Reject formula-prefixed values when formulas are never legitimate input.
  4. Add automated tests confirming that a source value beginning with = is stored as literal text rather than as a formula.
  5. Treat replaceable route and distribution JSON files as untrusted because their warehouse and geographic names are also written into reports.

T08 · Insecure Dependencies

Note
Location
SKILL.md:89
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 89-91
Vulnerability Type: Unrestricted third-party dependency resolution
Risk Level: Low

Vulnerable Code

bash
pip install pulp pandas openpyxl

Technical Analysis

The installation instructions request packages by name without specifying reviewed versions, cryptographic hashes, or a lock file. Consequently, every installation resolves whatever versions the configured Python package index currently considers appropriate.

This prevents reproducible deployments and expands the supply-chain attack surface. A future compromised release, compromised package-index account, malicious index configuration, or incompatible dependency update could introduce unexpected code into the environment.

The listed package names are consistent with the implementation and there is no evidence in the audited project that they are intentionally malicious or typosquatted. The issue is the absence of dependency integrity and version controls rather than evidence of an existing malicious dependency.

Attack Path

  1. A user follows the documented installation command.
  2. pip contacts the configured package index and resolves current package versions and transitive dependencies.
  3. If a resolved release or configured index has been compromised, malicious package code may be downloaded.
  4. Code may execute during source-package build processing or later when the installed package is imported and used.
  5. The dependency code executes with the privileges of the user running installation or optimization.

Impact Assessment

The potential impact is limited by the privileges of the user or service account running pip and the Skill. In a compromised-dependency scenario, package code could potentially:

  • Read or modify files accessible to that account.
  • Access input datasets and generated reports.
  • Use network access available to the Python process.

...[truncated 361 chars]

Remediation
View remediation

Remediation Suggestions

Replace the unpinned installation command with a reviewed and reproducible dependency manifest:

  1. Pin direct and transitive dependency versions in a lock file.

  2. Generate and verify cryptographic hashes for downloaded distributions.

  3. Install with hash enforcement where practical:

    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  4. Use a trusted package index explicitly configured through deployment policy.

  5. Prefer reviewed binary wheels where appropriate and avoid untrusted source builds.

  6. Run dependency vulnerability and provenance checks in CI.

  7. Perform installation inside an isolated virtual environment using a non-privileged account.

  8. Establish a controlled process for reviewing and updating pinned versions.

Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims production-ready MILP-based network optimization, transit-link modeling, waiting-time SLA calculations, and county-level supply allocation, but the finding indicates those capabilities are not actually implemented. This is dangerous because users may make logistics planning or investment decisions based on false assumptions about optimization rigor and output correctness, causing operational or financial harm.

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 description and the entire user-facing documentation are written in Chinese, with no indication that other languages are supported or that the skill is intentionally restricted to Chinese-speaking users. Under the policy, language constraints should be opt-in or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains its primary docstring, usage instructions, and runtime messages in Chinese only. Under the language/locale policy rule, forcing a specific language without giving the user a choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This JSON manifest-like data uses Chinese place names and labels throughout, which imposes a single language/locale for consumers of the skill data. Under the policy, forcing a specific language without documented user opt-in or justification 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
95% confidence
Finding

The module docstring presents the script name, changelog, and usage entirely in Chinese, which establishes a single-language user experience. Under the policy, forcing a specific language without offering user choice is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script prints operational guidance and status messages only in Chinese during execution. Because no language selection or opt-in is provided, this hard-codes a locale preference in user-facing text.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

模块文档和运行输出都将该脚本标识为 v2.7,并强调新增参数引导及必选/禁止仓库约束;但生成的执行摘要标题仍写为“v2.6”。这是内嵌文案对实际代码版本与能力说明的直接不一致,可能误导使用者对报告来源版本的判断。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The argparse description and argument help text are all written in Chinese, making the CLI locale-specific by default. This is a natural-language policy issue because the skill does not offer users a language choice or document a justified regional restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This JSON manifest/data file contains user-facing natural-language values such as warehouse names, route names, and transport labels exclusively in Chinese. Because the file provides no documented language choice, opt-in, or justification for a locale-specific constraint, it may violate the policy against forcing a specific language without user choice.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.