T08 · Insecure Dependencies
Warning
- Location
- references/preflight.md:8
- Finding
- Unpinned npm Dependency Installation Enables Supply-Chain Code Execution<![CDATA[ ## Vulnerability Details **File Location**: `references/preflight.md:8-14` **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```bash node -e "require('viem')" 2>/dev/null && echo OK || echo MISSING ``` If missing, install it: ```bash npm install viem ``` ### Technical Analysis The Skill instructs the Agent to install `viem` without specifying an exact version, lockfile, package integrity hash, trusted registry, or lifecycle-script policy. Consequently, the package and its transitive dependencies are resolved dynamically at execution time. This installation is necessary only when `viem` is unavailable, but resolving a mutable latest version is not the minimum-risk method required for the Skill's transaction-construction functionality. npm packages and transitive dependencies can execute lifecycle scripts during installation. A compromised package release, dependency, registry account, registry mirror, or local npm configuration could therefore turn this instruction into arbitrary local code execution. The command also does not use `npm ci` or `--ignore-scripts`, and the reviewed project contains no lockfile establishing a reproducible dependency graph. ### Attack Path 1. An attacker compromises a future `viem` release, one of its resolved dependencies, the configured npm registry, or a registry account. 2. The Skill checks for `viem` and determines that it is missing. 3. Following the documented workflow, the Agent runs `npm install viem`. 4. npm retrieves the currently resolved package graph rather than a reviewed, immutable version. 5. A malicious package lifecycle script executes during installation. 6. The payload runs with the operating-system permissions of the Agent or user that invoked npm. ### Impact Assessment Successful exploitation could execute arbitrary commands with the invoking user's privileges. Depending on the execution environment, the malicious package could ...[truncated 475 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `viem` to a reviewed exact version instead of installing the latest release: ```bash npm install --save-exact viem@<reviewed-version> ``` 2. Include and review a lockfile, then use reproducible installation: ```bash npm ci ``` 3. Disable lifecycle scripts where they are unnecessary: ```bash npm ci --ignore-scripts ``` 4. Document and enforce the expected npm registry, and reject unexpected registry overrides. 5. Verify package integrity through the committed lockfile and periodically audit the pinned dependency graph. 6. Prefer requiring callers to provide a preinstalled, approved dependency environment rather than modifying the environment automatically. 7. Never run dependency installation as root or another privileged account. ]]>
