T08 · Insecure Dependencies
Error
- Location
- skill.md:16
- Finding
- Unpinned Third-Party Package Installation<![CDATA[ ## Vulnerability Details **File Location**: `skill.md`, lines 16-20 **Vulnerability Type**: Supply-chain exposure through an unpinned npm dependency **Risk Level**: High ### Vulnerable Code ```markdown ## Setup Before using this skill, ensure x402-cfo is installed in the current project: ```bash npm list x402-cfo 2>/dev/null || npm install x402-cfo ``` ``` ### Technical Analysis The setup instruction installs `x402-cfo` without specifying an exact version or verifying package integrity. Consequently, installation resolves to whatever version the configured npm registry currently serves. The package's source code, lifecycle scripts, and runtime behavior are not included in the audited project. This dependency is especially sensitive because it receives a payment-capable wallet and mediates paid network requests. A compromised package release, registry account, registry configuration, or dependency chain could execute arbitrary JavaScript during installation or runtime. Redirecting `npm list` diagnostics to `/dev/null` also reduces visibility into errors that could indicate an unexpected local dependency state. The documented payment functionality legitimately requires an implementation dependency, but installing an unpinned and unaudited version is not necessary to provide that functionality. ### Attack Path 1. An attacker compromises the `x402-cfo` package, one of its transitive dependencies, its publisher account, or the configured npm registry. 2. The attacker publishes or serves a modified version containing a malicious lifecycle script or runtime payload. 3. The Agent follows the Skill setup instructions and runs `npm install x402-cfo`. 4. npm resolves and installs the attacker-controlled release because no exact version or integrity value is specified. 5. The malicious code executes with the permissions of the Agent process. 6. During initialization, the package may also gain access to the supplied wallet object and use or disclose its p ...[truncated 470 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin `x402-cfo` to a specific, reviewed version rather than installing the latest available release: ```bash npm install --save-exact x402-cfo@<audited-version> ``` 2. Commit and enforce a lockfile with verified registry integrity hashes. Use `npm ci` in controlled environments instead of dynamically resolving dependencies. 3. Audit the selected package version, its transitive dependencies, and all npm lifecycle scripts before deployment. 4. Use a trusted, explicitly configured package registry and enable package provenance verification where supported. 5. Disable lifecycle scripts during installation when they are unnecessary: ```bash npm ci --ignore-scripts ``` 6. Run the dependency in a sandbox with minimal filesystem, environment-variable, wallet, and network permissions. 7. Do not suppress dependency-check errors. Surface and handle installation failures explicitly. ]]>
