T03 · Remote Payload Retrieval and Execution
- Location
- scripts/setup.py:37
- Finding
- Mutable Remote Repository Is Retrieved and Installed Without Integrity Verification## Vulnerability Details **File Location**: `scripts/setup.py`, lines 37-88 **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: High ### Vulnerable Code ```python REPO_URL = "https://github.com/lijinlar/handsfree-windows.git" DEFAULT_INSTALL_DIR = Path.home() / ".handsfree-windows" / "cli" def clone_or_pull(install_dir: Path) -> bool: if (install_dir / ".git").exists(): print(f"\n[INFO] Repo already exists at {install_dir}. Pulling latest...") rc = run(["git", "pull", "--ff-only"], cwd=install_dir, desc="git pull") else: print(f"\n[INFO] Cloning handsfree-windows into {install_dir} ...") install_dir.parent.mkdir(parents=True, exist_ok=True) rc = run( ["git", "clone", REPO_URL, str(install_dir)], desc=f"git clone {REPO_URL}", ) return rc == 0 def pip_install(install_dir: Path) -> bool: print(f"\n[INFO] Installing handsfree-windows (editable) from {install_dir} ...") rc = run( [sys.executable, "-m", "pip", "install", "-e", str(install_dir)], desc="pip install -e", ) return rc == 0 ``` ### Technical Analysis The setup process retrieves the current contents of a mutable Git branch and immediately passes that checkout to `pip install -e`. It does not pin an audited commit or immutable release, verify a cryptographic checksum or signature, or validate that a pre-existing repository has the expected remote URL. A Python package installation can execute package build hooks and backend code. In addition, editable installation makes the installed command continue to reference the mutable checkout. The effective code executed by the skill can therefore differ from the code that existed when the skill was audited. The pre-existing-directory path creates another trust-boundary problem: the presence of `.git` is treated as sufficient proof that the directory is the e ...[truncated 1473 chars]
- Remediation
- ## Remediation Suggestions 1. Pin the dependency to a specifically reviewed commit hash or immutable, versioned release rather than pulling the active branch. 2. Verify the downloaded artifact with a trusted cryptographic hash or release signature before installation. 3. For an existing checkout, verify the canonicalized remote URL exactly matches the approved repository before running any Git operation. 4. Fetch the pinned commit explicitly and verify `HEAD` equals the expected hash. Do not use an unrestricted `git pull`. 5. Prefer a hash-verified wheel from a controlled package repository over an editable installation. 6. Avoid editable installations for production use because subsequent changes to the checkout immediately affect executable behavior. 7. Run installation with a non-privileged account in an isolated virtual environment, and do not execute package installation as an administrator. 8. Review and lock all transitive dependencies of the retrieved package.
