T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/research.sh:47
- Finding
- Unpinned npm Package Is Remotely Retrieved and Executed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/research.sh:47` **Vulnerability Type**: Remote execution of an unpinned third-party dependency **Risk Level**: High ### Vulnerable Code ```bash npx -y @itzannetos/x402-tools-claude find-people "$QUERY" ``` ### Technical Analysis The script uses `npx -y` to retrieve and execute `@itzannetos/x402-tools-claude` at runtime. No exact package version, lockfile, or integrity hash is specified. The `-y` option automatically accepts package installation without interactive confirmation. Consequently, the effective executable payload is not contained in the audited project and can change after review. A compromised npm publisher account, malicious future package release, registry compromise, or dependency-chain compromise could cause arbitrary JavaScript to execute under the invoking user's account. This is especially sensitive because the script exports `X402_PRIVATE_KEY` before invoking the package. The downloaded package therefore inherits the wallet private key and other environment variables available to the process. ### Attack Path 1. An attacker compromises the npm package, its publisher account, or one of its transitive dependencies. 2. The attacker publishes a malicious release under the existing package name. 3. A user runs `scripts/research.sh`. 4. `npx -y` resolves and downloads the current package release without confirmation or integrity validation. 5. The package executes locally with the privileges of the invoking user. 6. The malicious code reads `X402_PRIVATE_KEY` from its environment and may transmit it externally, authorize wallet transactions, access user-readable files, or execute additional commands. ### Impact Assessment Successful exploitation provides arbitrary code execution with the invoking user's operating-system privileges. The accessible scope includes: - The exported cryptocurrency wallet private key. - Wallet funds and signing authority associated with that key. - ...[truncated 380 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not retrieve executable packages dynamically during normal Skill execution. 2. Pin the package to a reviewed, exact version rather than a tag or version range. 3. Install dependencies during a controlled build or setup phase and commit an npm lockfile with integrity hashes. 4. Use `npm ci --ignore-scripts` where lifecycle scripts are unnecessary, and separately review any scripts that must run. 5. Vendor the required implementation into the project when feasible so its effective behavior is included in security review. 6. Verify package provenance and signatures, monitor publisher ownership changes, and routinely audit transitive dependencies. 7. Run the external client in a sandbox with restricted filesystem and network access. 8. Avoid exposing a raw private key to third-party package code. Prefer a constrained signing service or isolated signer that validates the network, destination, amount, and method before approving a transaction. ]]>
