Back to skill

Security audit

导购个人业绩分析

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but it should be reviewed because it handles employee performance data while loading code from a hard-coded external folder.

Review before installing in production. Confirm the API client is packaged or imported from a trusted, controlled location, remove the developer-local sys.path override, and ensure only authorized managers can run employee-level analyses with explicit store, clerk, and date parameters.

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
analyze.py:6
Finding

Unsafe External Module Resolution Through a Hard-Coded Import Path

Content
View full analysis

Vulnerability Details

File Location: analyze.py:6-8
Vulnerability Type: Python module path hijacking through an untrusted external dependency
Risk Level: Medium

Vulnerable Code

python
import sys
sys.path.insert(0, '/Users/yangguangwei/.openclaw/workspace-front-door')
from api_client import get_api_client

Technical Analysis

The skill prepends a hard-coded directory outside the project to sys.path. Because index 0 has the highest import priority, the subsequent api_client import resolves from that external directory before normal package locations.

Importing a Python module executes its top-level code immediately. The referenced api_client implementation is not included in the audited project, is not version-pinned, and cannot be integrity-checked from this repository. Consequently, the effective behavior of importing this skill depends on mutable code outside the audited package.

The same unsafe integration pattern is also recommended in USAGE.md:44-46, increasing the likelihood that users reproduce it:

python
import sys
sys.path.insert(0, '/Users/yangguangwei/.openclaw/workspace-front-door')
from api_client import get_api_client

Attack Path

  1. An attacker obtains write access to /Users/yangguangwei/.openclaw/workspace-front-door, or otherwise controls the directory at that path.
  2. The attacker creates or replaces api_client.py with a malicious module.
  3. A user or agent imports analyze.py.
  4. The sys.path.insert(0, ...) call prioritizes the attacker-controlled directory.
  5. Python imports the malicious api_client and executes its top-level code.
  6. The payload runs with the same operating-system identity and privileges as the agent process.

Exploitation requires the attacker to control the referenced directory or its module file. The audited project itself does not download or install a payload into that location.

Impact Assessment

...[truncated 632 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the runtime sys.path.insert() modification.

  2. Bundle the API client within a trusted package and use an explicit relative import where appropriate, for example:

    python
    from .api_client import get_api_client
    
  3. Alternatively, publish the client as a properly named dependency, pin its version and integrity hash, and install it through the project's controlled dependency-management process.

  4. Do not use a user-specific absolute path in executable code or documentation.

  5. If an external module location is operationally unavoidable:

    • Obtain it from administrator-controlled configuration rather than user input.
    • Restrict directory and file write permissions.
    • Validate ownership and reject writable-by-untrusted-user locations.
    • Verify the module against a trusted cryptographic digest before loading it.
    • Load it by an explicit verified file path rather than changing global import precedence.
  6. Update USAGE.md:44-46 to remove the unsafe example and document the secured dependency installation process.

  7. Add deployment tests that verify the imported api_client originates from the expected package and path.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

整体上,代码与声明描述高度一致:实现了导购个人分析、普通/AIoT门店分支、核心业绩、雷达、商品特征、Top5 SKU、订单结构、AIoT漏斗与高试用低转化、14天趋势,以及诊断建议。访问的资源也基本都属于导购分析相关接口,没有明显越权或无关外部能力。 但仍存在两点实质偏差。第一,代码提供了 batch_analyze 批量分析多个导购的能力,这不在声明中体现。第二,更关键的是 _generate_findings 中在 AIoT 场景下使用了未传入的 guide_name 变量,可能导致运行时异常,从而使声明中的“输出详细诊断报告”在部分路径下无法完整实现。按题目要求,若代码执行能力或实际行为与声明存在实质差异,应判定为 mismatch。

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases are broad enough to invoke the skill during ordinary conversation about an employee's performance, which can cause unintended access to sensitive personnel and sales analytics. In this context, the skill processes potentially sensitive employee-level business data, so overbroad activation increases the risk of privacy violations or disclosure to users who did not explicitly request detailed analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The title and all user-facing instructions in this file are presented only in Chinese, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-only audience. Under the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code prepends a hard-coded developer-local directory to sys.path before importing api_client, which can change import resolution and cause the skill to load unintended or attacker-controlled code from that path. In an agent/runtime environment, this creates a code-loading trust boundary violation and can lead to arbitrary code execution if that directory is writable or replaced.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill sends identifiable employee data such as guide names, store IDs, and detailed performance metrics across multiple API endpoints without any visible consent, minimization, or disclosure controls in the skill logic. In a people-performance analysis context, this raises a genuine privacy/security concern because sensitive personnel data is processed and potentially exposed through logs, downstream services, or unauthorized use of the skill.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The docstring and signature for _generate_findings describe a pure finding-generation helper over the supplied analysis dictionaries, but the implementation also tries to interpolate guide_name into a finding title. Since guide_name is not a parameter or local variable in this function, the documented interface does not match what the code actually requires and can fail at runtime on that branch.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

Natural-language strings throughout the file, including docstrings, logs, and outputs, are fixed in Chinese with no opt-in or alternative language handling. This can violate language/locale policy when a skill forces a specific language without user choice or documented regional justification.

Content

No source excerpt is available for this finding.