T08 · Insecure Dependencies
Warning
- Location
- scripts/clawhub_preflight.sh:7
- Finding
- Unpinned Global npm Package Installation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/clawhub_preflight.sh:7-11`; `references/error-map.md:46-49` **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```bash if command -v clawhub >/dev/null 2>&1; then ok "clawhub found: $(clawhub --cli-version 2>/dev/null || echo 'unknown version')" else warn "clawhub not found. Install: npm i -g clawhub" fi ``` The error map additionally recommends forced installation: ```markdown **Fix:** - Standardize on `clawhub`. - If needed, reinstall: `npm i -g clawhub --force` ``` ### Technical Analysis The installation instructions resolve the mutable latest version of the `clawhub` npm package without pinning a reviewed version or verifying package integrity or provenance. npm packages may execute lifecycle scripts during installation, so installing a compromised or unexpectedly changed release can execute code with the privileges of the user running npm. The `--force` recommendation further weakens installation safeguards and may overwrite an existing global package installation. The project does not itself perform the installation automatically, so exploitation requires a user to follow the displayed or documented command. ### Attack Path 1. An attacker compromises the npm package, a package maintainer account, or the package publishing process. 2. The attacker publishes a malicious release under the package name used by the instructions. 3. A user follows `npm i -g clawhub` or `npm i -g clawhub --force`. 4. npm retrieves the mutable latest release and may execute its lifecycle scripts. 5. The malicious package executes with the installing user's privileges and persists as a globally available command. ### Impact Assessment Successful exploitation can provide arbitrary code execution under the installing user's account. A global installation can also replace the trusted `clawhub` executable and affect subsequent publishing and authe ...[truncated 309 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Pin the installation command to a reviewed release, for example `npm install --global clawhub@<reviewed-version>`. - Document the package's official registry location, publisher, and source repository. - Verify npm provenance, release signatures, or expected integrity metadata before installation. - Avoid recommending `--force` as a standard recovery action. Require users to investigate package conflicts before replacing an existing global installation. - Prefer a lockfile-controlled or isolated installation mechanism where practical. - Establish a process for reviewing and updating the pinned version when security fixes are released. ]]>
