T08 · Insecure Dependencies
- Location
scripts/run.sh:38- Finding
Automatic Installation of Unpinned Third-Party Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
scripts/run.sh, lines 38-43
Vulnerability Type: Supply-chain exposure through automatic installation of unpinned dependencies
Risk Level: MediumVulnerable Code
bash # 检查依赖库 python3 -c "import requests, bs4" 2>/dev/null if [ $? -ne 0 ]; then echo "正在安装必要的依赖库..." pip3 install requests beautifulsoup4 -q fiTechnical Analysis
The launcher automatically invokes
pip3when either required module is unavailable. The packagesrequestsandbeautifulsoup4are installed without fixed versions or verified hashes. Package resolution also relies on the user's ambient pip configuration rather than an explicitly trusted repository.This makes the executed dependency set mutable after the Skill has been reviewed. A compromised future package release, compromised package index, malicious mirror, or attacker-controlled pip configuration could cause pip to retrieve and install attacker-controlled code. Python packages can execute code during installation through build backends and related packaging mechanisms, and malicious runtime code would subsequently be imported by
fetch.py.The use of a generic
pip3executable instead ofpython3 -m pipalso creates a risk that dependencies are installed into a different interpreter environment or that an unexpected executable found throughPATHis invoked.Attack Path
- The victim runs
scripts/run.shin an environment whererequestsorbs4cannot be imported. - The dependency check fails and enters the installation branch.
- An attacker has compromised a resolved dependency release or controls the package source through pip configuration, a configured mirror, or the execution environment.
pip3 install requests beautifulsoup4 -qdownloads and processes the attacker-controlled package or build dependency without checking approved versions or hashes.- Malicious installation logic execu ...[truncated 740 chars]
- The victim runs
- Remediation
View remediation
Remediation Suggestions
- Remove automatic package installation from
run.sh. If dependencies are missing, terminate with a clear message and direct the operator to an explicit installation procedure. - Declare reviewed, exact dependency versions in a requirements or lock file.
- Generate and enforce cryptographic hashes for every package and transitive dependency, for example by installing with
--require-hashes. - Install dependencies inside a dedicated virtual environment rather than modifying the user's global or ambient Python environment.
- Invoke pip through the selected interpreter, such as
python3 -m pip, to ensure interpreter consistency. - Use an explicitly configured trusted package index or an internally controlled artifact repository. Do not rely on unreviewed ambient pip configuration.
- Separate dependency installation from routine execution so installation is a deliberate, auditable deployment step.
- Run the Skill as a least-privileged account and prevent privileged automation from installing packages dynamically.
- Remove automatic package installation from
