T08 · Insecure Dependencies
- Location
scripts/agent.py:7- Finding
Unpinned Dependency Installation Through pip
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This QR-code skill does the advertised job, but it automatically installs unpinned Python packages and can overwrite any writable file path the agent is told to use.
Review before installing. Use this only in an isolated or managed Python environment, preinstall reviewed dependencies yourself, and avoid letting untrusted instructions choose the output path. Treat any requested save location as a real filesystem write that may create directories or replace an existing file.
scripts/agent.py:7Unpinned Dependency Installation Through pip
scripts/agent.py:50User-Controlled Save Path Permits Arbitrary Writable-File Overwrite
This skill performs automatic package installation for a basic QR utility, which is unnecessary for core functionality and increases attack surface. In an agent/skill context, silently modifying the environment and pulling code from package repositories can expose the host to supply-chain compromise, unexpected network access, and persistence of unreviewed code.
Executing pip automatically without prior warning or consent is unsafe because it performs network-enabled code acquisition and changes the local Python environment as a side effect of loading the skill. In a security-sensitive agent ecosystem, such hidden installation behavior is especially dangerous because users may not expect a QR generator to reach out to external repositories or alter the host.
Comments, docstrings, and all returned user-facing status/error messages are written in Chinese, with no indication that the user can choose another language. This creates a language/locale policy concern because the skill implicitly forces a specific language without opt-in or documented justification.
Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.
required_packages = ["qrcode", "pillow"]
for package in required_packages:
try:
__import__(package) # 检查库是否已安装
except ImportError:
# 自动安装缺失的库
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
The script invokes pip automatically via subprocess at import/initialization time, causing code from external packages to be fetched and installed without user confirmation. Even though shell injection is not present because arguments are passed as a list, this still expands the skill's privileges and creates a supply-chain and unauthorized system modification risk inappropriate for a simple QR generator.
__import__(package) # 检查库是否已安装
except ImportError:
# 自动安装缺失的库
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
# 初始化:安装依赖库
install_dependencies()