T08 · Insecure Dependencies
Warning
- Location
- scripts/install.sh:29
- Finding
- Unpinned PyPI Dependency Installation## Vulnerability Details **File Location**: `scripts/install.sh:29-34` **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ```bash if python3 -c "import yaml" 2>/dev/null; then info "PyYAML already installed" else echo "Installing PyYAML..." pip3 install --user pyyaml info "PyYAML installed" fi ``` ### Technical Analysis The installation script retrieves and installs the latest available `pyyaml` package without a version constraint, cryptographic hash verification, lock file, or isolated virtual environment. This makes the installed code dependent on mutable upstream package-index state rather than the reviewed project contents. Python package installation may execute package build or installation code with the privileges of the user running the installer. A compromised upstream release, package-index compromise, or index redirection could therefore cause arbitrary code execution even though the project itself contains no confirmed malicious payload. ### Attack Path 1. An attacker compromises the upstream package, its publishing credentials, or the configured Python package index. 2. The attacker publishes or serves a malicious `pyyaml` distribution. 3. A user without an importable `yaml` module runs `bash scripts/install.sh`. 4. The script executes `pip3 install --user pyyaml` without pinning or hash verification. 5. `pip` downloads the attacker-controlled distribution and executes any applicable build or installation logic. 6. The malicious code runs with the installing user's privileges and may establish additional persistence, modify user files, or access user-session data. ### Impact Assessment Successful exploitation provides arbitrary code execution as the user who runs the installer. This may expose files readable by that user, browser and application data accessible within the user session, OpenClaw configuration, shell configuration, and other user-owned resources. The command does not i ...[truncated 123 chars]
- Remediation
- ## Remediation Suggestions - Pin PyYAML to a specifically reviewed version instead of installing the latest release. - Maintain a requirements lock file containing cryptographic hashes and install with `pip --require-hashes`. - Use an isolated virtual environment rather than modifying the user's package environment. - Prefer binary wheels from a trusted index where practical, and explicitly configure the approved package index. - Ensure installation fails closed if the dependency cannot be verified. - Periodically review and deliberately update the pinned version after security testing. Example hardened workflow: ```bash python3 -m venv "$CONFIG_DIR/venv" "$CONFIG_DIR/venv/bin/python" -m pip install \ --require-hashes \ --only-binary=:all: \ -r "$PROJECT_DIR/requirements.lock" ``` The corresponding `requirements.lock` should pin the exact PyYAML version and list approved SHA-256 hashes for every supported artifact.
