Back to skill

Security audit

b402 Private DeFi

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-aligned for private DeFi, but it asks users to run mutable third-party install code and grants fund-moving wallet authority with limited safety disclosure.

Review this carefully before installing. Use only a reviewed pinned package version, keep wallet funds limited, protect or isolate `WORKER_PRIVATE_KEY` and `~/.b402/wallet.json`, and require manual review of every transaction route, amount, destination, and chain before signing.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Error
Location
SKILL.md:28
Finding
Unpinned Third-Party npm Package Is Downloaded and Executed<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 15-18 and 28-33 **Vulnerability Type**: Unpinned third-party dependency execution **Risk Level**: High ### Vulnerable Code ```yaml install: - kind: node package: b402-mcp bins: [b402-mcp] ``` ```markdown ## Install ```bash npx b402-mcp@latest --claude ``` This generates a wallet at `~/.b402/wallet.json`, patches your Claude Desktop config, and registers the MCP server. Fund the wallet with USDC on Base to start. ``` ### Technical Analysis The documented command uses `npx b402-mcp@latest --claude`, which downloads and executes the release currently associated with the npm `latest` tag. The package is not pinned to a reviewed version or integrity hash. The installation metadata similarly names `b402-mcp` without a fixed version. As a result, the code executed by users can change after this skill has been reviewed. The external package implementation is not included in the audited project, so its behavior cannot be verified from the available artifact. The documented package capabilities make this supply-chain exposure security-sensitive. It reportedly creates a cryptocurrency wallet, modifies Claude Desktop configuration, registers an MCP server, and operates in an environment requiring `WORKER_PRIVATE_KEY`. A compromised publisher account, malicious package release, or unexpected upstream change could therefore execute arbitrary code in a context involving wallet credentials and asset-moving operations. No evidence in `SKILL.md` proves that the current npm package is malicious. The confirmed issue is the unsafe, unpinned execution mechanism and the resulting inability to guarantee that future installations execute the reviewed implementation. ### Attack Path 1. An attacker compromises the `b402-mcp` npm publisher account, package, or release process. 2. The attacker publishes a malicious version and assigns it to the `latest` distribution tag. 3. A user follows the skil ...[truncated 1616 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `@latest` with an exact, reviewed package version: ```bash npx b402-mcp@0.4.2 --claude ``` The selected version must correspond to a version that has actually undergone security review; the example version should not be adopted without verification. 2. Pin the exact package version in the skill installation metadata rather than relying on a floating release or default npm resolution. 3. Install through a lockfile-controlled workflow and verify npm registry integrity metadata. For security-critical deployments, validate the package tarball checksum against a separately published, trusted checksum. 4. Review the source code and lifecycle scripts of the exact `b402-mcp` release before execution. Disable unnecessary npm lifecycle scripts where the package supports installation without them. 5. Avoid exposing `WORKER_PRIVATE_KEY` to installation or configuration steps. Provide the secret only to the minimal runtime component that requires signing authority. 6. Store wallet files with restrictive filesystem permissions and avoid plaintext private-key storage where a hardware-backed or isolated signer can be used. 7. Require explicit user confirmation for wallet creation, configuration changes, signing requests, and every operation that moves assets. 8. Run the MCP server under a dedicated, least-privileged account or sandbox with narrowly scoped filesystem, network, environment-variable, and wallet access. 9. Display and validate all transaction parameters—including chain, token, amount, destination, and contract—before signing. 10. Document the reviewed package version and update process so that upgrades require a new security review instead of automatically following the `latest` tag. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding
The install command uses `npx b402-mcp@latest`, which fetches and executes whatever code is current at install time rather than a reviewed, immutable version. In a skill that patches local config, registers an MCP server, and handles a private key for fund-moving operations, a compromised or malicious package update could immediately lead to code execution, credential theft, or unauthorized transactions.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill states that installation generates a wallet at `~/.b402/wallet.json`, but it does not clearly warn users that this creates sensitive key material on disk. For a financial skill managing private DeFi activity, undocumented local key storage increases the risk of accidental exposure through weak file permissions, backups, logs, malware, or multi-user systems.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill exposes tools for shielding, swapping, lending, redeeming, bridging, and executing multi-step strategies, but it does not present a prominent warning that these actions can transfer funds across multiple protocols and chains with irreversible outcomes. In this context, the omission is especially dangerous because the skill is explicitly designed to move assets privately and 'gaslessly,' which may reduce user friction and encourage high-trust execution without understanding bridge, routing, slippage, smart contract, or destination-address risks.

Static analysis

No suspicious patterns detected.