T08 · Insecure Dependencies
Warning
- Location
- scripts/convert_epub.py:37
- Finding
- Automatic Installation of Unpinned Python Dependencies## Vulnerability Details **File Location**: `scripts/convert_epub.py:37-38` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ```python # Install dependencies pip_path = venv_path / "bin" / "pip" subprocess.run( [str(pip_path), "install", "ebooklib", "opencc-python-reimplemented"], check=True ) ``` ### Technical Analysis When required modules are unavailable, the script automatically invokes `pip` to install `ebooklib` and `opencc-python-reimplemented`. Neither package is pinned to a reviewed version, and no lockfile, package hashes, trusted index restriction, or integrity verification is used. Consequently, the code installed during each initial setup depends on the mutable state of the configured Python package index and its transitive dependency graph. The virtual environment is retained at `~/.openclaw/epub_venv`, and its `site-packages` directory is subsequently inserted at the beginning of `sys.path`. Installed package code is therefore imported and executed with the privileges of the user running the converter. The same unpinned installation command is also recommended in `SKILL.md:78` and `README.md:81`, reinforcing the unsafe installation practice. ### Attack Path 1. An attacker compromises a direct dependency, one of its transitive dependencies, or the package index configured in the execution environment. 2. A user runs the EPUB converter on a system where the required modules or virtual environment are absent. 3. `check_dependencies()` creates or reuses `~/.openclaw/epub_venv`. 4. The script invokes `pip install` without version or hash constraints. 5. `pip` resolves and installs the attacker-controlled package release. 6. The installed package is imported by the converter, causing attacker-controlled Python initialization code to execute. 7. The compromised package remains in the persistent virtual environment and can execute again during subsequent conversions. ...[truncated 714 chars]
- Remediation
- ## Remediation Suggestions 1. Remove automatic dependency installation from the normal EPUB conversion path. Provide a separate, explicit installation step requiring user approval. 2. Pin all direct and transitive dependencies to reviewed versions in a lockfile. 3. Record and verify package hashes, and install with `pip install --require-hashes`. 4. Configure an explicitly trusted package index rather than relying on ambient user or system `pip` configuration. 5. Build and distribute a reviewed environment or reproducible package artifact where practical. 6. Before reusing `~/.openclaw/epub_venv`, verify that the directory and its contents are owned by the expected user and are not writable by untrusted principals. 7. Do not prepend an unverified environment to `sys.path`; validate the environment before importing from it. 8. Update `SKILL.md` and `README.md` so their manual installation instructions use the same pinned, hash-verified dependency set. 9. Periodically review dependency advisories and regenerate the lockfile through a controlled update process.
