T07 · Tool Hijacking and Spoofing
- Location
summary_review_llm.py:14- Finding
Untrusted Parent-Directory Module Import Enables Local Tool Hijacking
- Content
View full analysis
Vulnerability Details
File Location:
summary_review_llm.py:14-17
Vulnerability Type: Untrusted Python import path manipulation
Risk Level: HighVulnerable Code
python import sys # Import the universal LLM client sys.path.insert(0, str(Path(__file__).parent.parent)) from llm_client import UniversalLLMClientTechnical Analysis
The script prepends its parent directory to
sys.pathbefore importingllm_client. Thellm_clientmodule is not included in the audited project and is not declared as an installed dependency.Because the parent directory is placed first in Python's module search path, any
llm_client.pyfile orllm_clientpackage located there will be imported and its module-level code executed. The Skill therefore delegates critical network and credential handling to unreviewed code outside its package boundary.This also prevents verification of the external LLM endpoints, TLS configuration, API-key handling, and content-transmission behavior identified by the static pre-scan.
Attack Path
- An attacker, compromised installer, or another package gains the ability to place files in the parent directory of the Skill.
- The attacker creates a malicious
llm_client.pyorllm_clientpackage in that directory. - A user launches
summary_review_llm.py. - The script inserts the parent directory at the beginning of
sys.path. - Python imports and executes the attacker's module as
llm_client. - The malicious module can capture API keys and summarized content or run arbitrary commands with the invoking user's privileges.
Impact Assessment
Successful exploitation provides arbitrary Python code execution under the account running the Skill. The malicious module can access files and environment variables available to that account, including configured LLM API keys, intercept content submitted for summarization, modify generated output, and initiate unauth ...[truncated 164 chars]
- Remediation
View remediation
Remediation Suggestions
- Package the reviewed LLM client inside the Skill and use an explicit package-relative import.
- Remove the
sys.path.insertmodification. - Declare the client as a version-locked dependency if it must remain a separate package.
- Verify dependency provenance and integrity with hashes.
- Fail safely when the expected client is unavailable rather than searching an uncontrolled parent directory.
- Apply an allowlist to supported providers and network destinations.
- Add tests that verify the resolved module path is inside the expected package or virtual environment.
