T08 · Insecure Dependencies
Warning
- Location
- skill.md:16
- Finding
- Unpinned npm Dependencies Execute in a Wallet-Sensitive Environment<![CDATA[ ## Vulnerability Details **File Location**: `skill.md:16` **Vulnerability Type**: Unpinned third-party dependencies and npm lifecycle script exposure **Risk Level**: Medium ### Vulnerable Code ```bash npm install 8004-solana @solana/web3.js ``` ### Technical Analysis The installation instructions do not pin either npm dependency to an exact, reviewed version and do not provide a lockfile or integrity verification mechanism. Consequently, running the command can resolve package versions that differ from those reviewed when the Skill was authored. By default, npm may execute package lifecycle scripts during installation. Such scripts run with the permissions of the user invoking npm and can access files, environment variables, and network resources available to that process. This is particularly sensitive because the Skill declares and later reads `SOLANA_PRIVATE_KEY`: ```typescript const signer = Keypair.fromSecretKey( Uint8Array.from(JSON.parse(process.env.SOLANA_PRIVATE_KEY!)) ); ``` There is no evidence that the named packages are currently malicious. The vulnerability is the mutable and insufficiently verified supply-chain boundary: a compromised package release, maintainer account, or transitive dependency could introduce code after the Skill itself has been reviewed. ### Attack Path 1. An attacker compromises a dependency maintainer, npm publishing credential, or transitive package. 2. The attacker publishes a malicious version that satisfies the unpinned installation request. 3. A user follows the Skill instructions and runs `npm install 8004-solana @solana/web3.js`. 4. npm resolves and downloads the attacker-controlled release. 5. A malicious lifecycle script executes during installation, or malicious package code executes when the SDK is imported. 6. The payload accesses resources available to the Node.js process, potentially including wallet-related environment variables or local files. 7. The payload may exfiltrate credentials, m ...[truncated 840 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every direct dependency to an exact reviewed version: ```bash npm install --save-exact 8004-solana@0.6.3 @solana/web3.js@REVIEWED_VERSION ``` 2. Commit a reviewed `package-lock.json` and instruct users to install with: ```bash npm ci ``` 3. Verify lockfile integrity metadata and review transitive dependency changes before upgrades. 4. Disable lifecycle scripts during installation where package functionality permits: ```bash npm ci --ignore-scripts ``` If scripts are required, explicitly document and review each script before enabling it. 5. Perform installation in an environment where wallet keys and service credentials are not present. Inject `SOLANA_PRIVATE_KEY` only at runtime and only into the process that requires signing. 6. Prefer a dedicated, low-privilege runtime account or isolated container with restricted filesystem and network access. 7. Add dependency scanning and provenance checks, such as npm audit, automated lockfile review, package signature or provenance verification, and allowlisting of expected package sources. 8. Test dependency updates separately before changing pinned versions. Do not use floating version ranges for wallet-sensitive production deployments. ]]>
