T08 · Insecure Dependencies
- Location
analyze.py:31- Finding
Untrusted External Module Loading Through Search-Path Injection
- Content
View full analysis
Vulnerability Details
File Location:
analyze.py, lines 31-33
Vulnerability Type: Unsafe external dependency loading
Risk Level: HighVulnerable Code
python # 添加 API 客户端路径 sys.path.insert(0, '/Users/yangguangwei/.openclaw/workspace-front-door') from api_client import get_copilot_dataTechnical Analysis
The module prepends a hardcoded directory outside the audited Skill package to Python's module search path and then imports
api_clientfrom that location. Because the inserted path has the highest import precedence, anapi_client.pyfile in that directory will be loaded instead of a reviewed or installed package.The referenced module is not included in the project, so its implementation, integrity, version, and side effects cannot be audited. Python executes top-level module code during import, meaning that control over the referenced file is sufficient to execute arbitrary code merely by importing
analyze.py.This is also a deployment integrity problem: the path is tied to a particular developer account and may resolve differently, fail, or be populated with unrelated code on another system.
Attack Path
- An attacker gains write access to
/Users/yangguangwei/.openclaw/workspace-front-door, or compromises a process responsible for populating that directory. - The attacker creates or replaces
api_client.pywith malicious Python code. - A user or Agent loads the Skill, causing
analyze.pyto be imported. - Python searches the attacker-influenced directory first.
- The malicious module's top-level code executes before the Skill performs any analysis.
- The malicious module can also provide a spoofed
get_copilot_datafunction to intercept parameters and API responses during later calls.
Impact Assessment
Successful exploitation provides arbitrary code execution with the same operating-system identity and privileges as the Agent process. Depending on that pr ...[truncated 589 chars]
- An attacker gains write access to
- Remediation
View remediation
Remediation Suggestions
- Remove the
sys.path.insertcall and the user-specific absolute path. - Place the reviewed API client inside the Skill package and use an explicit package-relative import, such as:
python from .api_client import get_copilot_data - If the client must be shared, distribute it through normal dependency management with an exact version pin and integrity verification.
- Ensure dependency directories are not writable by untrusted users or lower-privileged processes.
- Validate the client package's origin and include it in security reviews.
- Avoid import-time side effects in the API client.
- Run the Skill under a least-privileged account with access only to the credentials and data required for SKU analysis.
- Remove the
