T08 · Insecure Dependencies
- Location
scripts/utils.py:23- Finding
Automatic Installation of Mutable Runtime Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
scripts/utils.py:23-29, 52-62
Vulnerability Type: Unsafe runtime dependency installation
Risk Level: HighComplete Code Snippet
python REQUIRED_PACKAGES = { "openpyxl": "openpyxl>=3.1.0", "pandas": "pandas>=2.0.0", "xlsxwriter": "xlsxwriter>=3.1.0", "xlrd": "xlrd>=2.0.0", "msoffcrypto": "msoffcrypto-tool>=5.0.0", "numpy": "numpy>=1.24.0", }python if auto_install: print(f"[自动安装] 检测到缺失依赖,正在安装: {', '.join(missing)}", file=sys.stderr) import subprocess try: subprocess.check_call( [sys.executable, "-m", "pip", "install", "--quiet", "--disable-pip-version-check"] + missing, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, timeout=120 ) print("[自动安装] ✅ 依赖安装完成", file=sys.stderr)The automatic installation is invoked by
convert.py:257,peek.py:269,read_excel.py:249, andwrite_excel.py:232.Technical Analysis
When any required import is unavailable, the Skill automatically invokes pip without requiring explicit approval. Although
scripts/requirements.txtcontains exact versions, this runtime installation path does not use that file. Instead, it uses open-ended minimum constraints such aspandas>=2.0.0.Pip therefore resolves whichever currently available versions satisfy those constraints from the configured package index. No package hashes, immutable lock file, trusted-index restriction, or isolated environment is enforced. Python packages may execute installation or build logic, and their imported modules execute with the same operating-system privileges as the Agent.
This is a supply-chain weakness rather than evidence that the currently named packages are malicious.
Attack Path
- One or more required packages are absent from the Agent's Python environment.
- The Agent invo ...[truncated 897 chars]
- Remediation
View remediation
Remediation Suggestions
- Disable automatic dependency installation by default.
- Require explicit user confirmation before making network requests or modifying the Python environment.
- Install dependencies from the exact-version manifest rather than constructing open-ended package specifications in code.
- Generate a lock file containing hashes and install with hash verification, such as
pip install --require-hashes. - Restrict package retrieval to an explicitly configured trusted index.
- Install dependencies inside a dedicated virtual environment with minimal filesystem and network permissions.
- Separate dependency setup from spreadsheet processing so ordinary file inspection cannot silently modify the environment.
- Record the resolved dependency versions and source index for auditability.
