T08 · Insecure Dependencies
Error
- Location
- scripts/check.py:93
- Finding
- Unpinned npx Package Execution Creates a Supply-Chain Code Execution Risk## Vulnerability Details **File Location**: `scripts/check.py`, line 93 **Vulnerability Type**: Unpinned executable dependency **Risk Level**: High ```python # Use list form to avoid shell injection stdout, stderr, code = run_command(["npx", "clawhub", "inspect", slug, "--json"]) ``` The same unpinned `npx clawhub` invocation pattern is also used for file inspection, searching, and listing. `SKILL.md` similarly instructs users to invoke `npx clawhub` without a pinned package version. ### Technical Analysis Invoking a package through `npx` without pinning and locally provisioning a reviewed version can cause npm to resolve and download executable package code at runtime. Avoiding `shell=True` protects against shell metacharacter injection in the slug, but it does not protect against a compromised, malicious, or unexpectedly changed npm package. npm package installation and lifecycle behavior occurs with the privileges of the user running the guardian. The subprocess also inherits the parent process environment because no restricted `env` is supplied to `subprocess.run`. Consequently, remotely resolved package code may be able to read workspace files, user configuration, npm credentials, API tokens, SSH material, and other environment variables accessible to that user. This exceeds the minimum privileges needed for a read-only scanner: the implementation needs a known ClawHub client, but it delegates execution to a potentially mutable package resolved at runtime. ### Attack Path 1. An attacker compromises the npm package, its publisher account, or another relevant dependency in its dependency graph. 2. The attacker publishes a malicious version that preserves expected CLI output while adding malicious installation or runtime behavior. 3. A user runs `scripts/check.py` on an otherwise legitimate skill. 4. `npx` resolves or downloads the unpinned package and executes attacker-controlled code. 5. The malicious package runs ...[truncated 702 chars]
- Remediation
- ## Remediation Suggestions - Install a reviewed ClawHub CLI version ahead of time and invoke its fixed executable directly rather than allowing `npx` to download packages on demand. - Pin an exact package version and verify its integrity using a committed lockfile and npm integrity metadata. - Use `npx --no-install` or the corresponding modern npm option so the scan fails if the approved local dependency is unavailable. - Consider vendoring or packaging the reviewed client as part of a reproducible deployment. - Run the external CLI with a minimal environment rather than inheriting all environment variables. - Execute the scanner in a sandbox with read-only workspace access, no unnecessary credentials, and restricted outbound networking. - Apply the same hardening to every `npx clawhub` invocation documented in `SKILL.md` and implemented in `scripts/check.py`.
