T08 · Insecure Dependencies
- Location
hooks/pre-install.sh:7- Finding
Unpinned dependency execution through npx weakens the security gate
- Content
View full analysis
/dev/null || true) ``` ### Technical Analysis The security hook executes `tsx` through `npx` without referencing a pinned, integrity-verified local executable. If `tsx` is unavailable locally, `npx` may resolve and download the package from the configured package registry. Consequently, code that was not included in or reviewed with this project can execute during every security scan. The scanner root and CLI path are also environment-overridable. Although configurability may be intentional, the hook does not authenticate the selected scanner or ensure that it is a trusted installation. Because this dependency runs inside the security decision path, compromise or unexpected package resolution can both execute arbitrary code and forge the score used to approve an installation. ### Attack Path 1. The user invokes `install.sh`, which calls `hooks/pre-install.sh`. 2. The local environment does not contain a trusted `tsx` executable, or dependency resolution is influenced by a compromised registry or configuration. 3. `npx` obtains and executes an unpinned package. 4. Package initialization or executable code runs with the invoking user's privileges. 5. The malicious dependency can access user-readable files, alter scanner output, or return an artificial passing score. 6. The guard installs a target that did not receive a trustworthy scan. A local process capable of controlling the invocation environment could also set `SCANNER_ROOT` or `SCANNER_CLI` to attacker-controlled scanner code. ### Impact Assessment Successful exploitation permits arbitrary ...[truncated 325 chars]- Remediation
View remediation
&2 exit 30 } RAW=$(cd "$SCANNER_ROOT" && "$TSX_BIN" "$SCANNER_CLI" "$SKILL_PATH" --json) ``` 4. Use lockfile integrity metadata and an approved registry. 5. Canonicalize and validate `SCANNER_ROOT` and `SCANNER_CLI`. 6. If environment overrides must remain supported, document that they are trust-boundary inputs and reject paths that are writable by untrusted users. 7. Preserve the scanner's actual exit status instead of suppressing it with `|| true`; fail closed when scanner execution fails. ]]>
