Back to skill

Security audit

agent-wallet

Security checks for vulnerabilities and agentic risk

Overview

This is a clearly disclosed Bitcoin Lightning wallet skill, but it asks agents to run mutable npm code for a mainnet wallet that stores a real private seed and can send funds.

Review this before installing. Use only a pinned, reviewed package version rather than unpinned `npx` or `@latest`; start with an unfunded wallet; back up the mnemonic offline; restrict permissions on `~/.mdk-wallet/`; and do not let agents send payments without explicit limits or human approval.

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:179
Finding

Unpinned Remote npm Package Execution for a Mainnet Wallet

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 179-185
Vulnerability Type: Supply-chain risk caused by executing an unpinned remote npm package
Risk Level: High

bash
## Upgrading

```bash
# Stop the running daemon
npx @moneydevkit/agent-wallet stop

# Run with @latest to pull the newest version
npx @moneydevkit/agent-wallet@latest start
text

The same unsafe pattern also appears in operational examples throughout `SKILL.md`, including lines 55-65, 79, and 106-173, where `npx @moneydevkit/agent-wallet` is invoked without an exact version.

### Technical Analysis

The skill directs the agent to use `npx` to retrieve and immediately execute `@moneydevkit/agent-wallet`. The upgrade procedure explicitly selects the mutable `@latest` tag, while most other examples omit a version and therefore also resolve through mutable package metadata.

This project's only audited file is `SKILL.md`; it does not contain the dependency's executable implementation. Consequently, the code that handles the BIP39 mnemonic, wallet transactions, local daemon, filesystem state, and outbound connections is outside the reviewed artifact and can change after this audit.

Although line 48 recommends pinning version `0.11.0` in production, that recommendation is not applied consistently to the documented commands. Package repository links also do not cryptographically bind the downloaded npm artifact to reviewed source code.

### Attack Path

1. An attacker compromises the npm publisher account, package release process, or a transitive dependency used by `@moneydevkit/agent-wallet`.
2. The attacker publishes a malicious release and causes it to resolve through the unpinned package name or the `@latest` tag.
3. An agent follows the documented `npx` command.
4. `npx` downloads and executes the modified package under the agent user's account.
5. The malicious package reads `~/.mdk-wallet/config.json`, captures the BIP39 mn
...[truncated 1061 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace every invocation with a reviewed, exact package version, for example:

    bash
    npx --yes @moneydevkit/agent-wallet@0.11.0 start
    

    Apply the exact version consistently to initialization, balance, receive, send, daemon-management, and upgrade commands.

  2. Remove @latest from operational documentation. Treat upgrades as a separate, explicitly approved process that includes source review, release verification, and testing before the new version can access a funded wallet.

  3. Prefer a lockfile-backed installation over ad hoc npx retrieval. Pin all transitive dependencies and preserve npm integrity hashes. For stronger assurance, vendor or build the dependency from a reviewed commit and verify the produced artifact.

  4. Verify package provenance, publisher identity, signatures or attestations where available, and correspondence between the npm tarball and the cited source repository.

  5. Run the wallet under a dedicated, unprivileged operating-system account or sandbox. Restrict filesystem access to the required wallet directory and allow outbound network access only to necessary endpoints.

  6. Enforce owner-only permissions on ~/.mdk-wallet/ and its mnemonic-bearing configuration. Keep mnemonic backups outside the runtime environment and avoid exposing the seed in logs or command output.

  7. Test upgrades with an unfunded wallet before approving them for mainnet use. Require explicit human authorization for high-value or unusual outbound payments.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (23)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The documentation instructs users to manually run rm -rf ~/.mdk-wallet to reinitialize the wallet. In a high-value financial tool, destructive shell commands increase the chance of accidental data loss, irreversible seed deletion, and unsafe copy-paste behavior, especially when used by agents or automation.

Content

Scanner excerpt · SKILL.md (reported line 106)May include surrounding context.

bash
npx @moneydevkit/agent-wallet stop
rm -rf ~/.mdk-wallet  # WARNING: backup mnemonic first!
npx @moneydevkit/agent-wallet init

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The documentation instructs users to manually run rm -rf ~/.mdk-wallet to reinitialize the wallet. In a high-value financial tool, destructive shell commands increase the chance of accidental data loss, irreversible seed deletion, and unsafe copy-paste behavior, especially when used by agents or automation.

Content

Scanner excerpt · SKILL.md (reported line 106)May include surrounding context.

bash
npx @moneydevkit/agent-wallet stop
rm -rf ~/.mdk-wallet  # WARNING: backup mnemonic first!
npx @moneydevkit/agent-wallet init

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding

The documentation instructs users to execute npx @moneydevkit/agent-wallet without a pinned version, which causes code to be fetched and executed from the npm registry at runtime. For a wallet tool that stores a mnemonic controlling real funds, a compromised publisher account, malicious update, or dependency hijack could immediately lead to seed exfiltration or unauthorized payments.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding

This unpinned npx example executes whatever version is current in npm at the time of use. Because the package operates a wallet daemon and handles a BIP39 mnemonic, any malicious or compromised release could steal funds or persist hostile local services.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The skill intentionally starts a persistent local daemon and stores wallet/payment state across sessions. Persistence itself is expected for a wallet, but in an agent setting it increases risk because sensitive state and payment capability survive beyond a single invocation, expanding the blast radius of compromise or misuse.

Content

Scanner excerpt · SKILL.md (reported line 61)May include surrounding context.

md
# Get balance
npx @moneydevkit/agent-wallet balance

# Create invoice
npx @moneydevkit/agent-wallet receive 1000

# Pay someone

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding

An unpinned runtime package execution path is risky in general, and especially so here because the tool manages self-custodied cryptocurrency keys. The skill context increases severity since the tool can both access the mnemonic and initiate outbound payments.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding

The example encourages npx execution of the latest registry version rather than a fixed, audited build. If the npm package or one of its dependencies is poisoned, users may run attacker-controlled code with access to wallet state and payment capabilities.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

First-time initialization is one of the most sensitive operations because it generates and stores the wallet seed. Performing that step via unpinned npx means the trust boundary is the live npm registry rather than a vetted release, making seed compromise plausible if the supply chain is attacked.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The init --show invocation is another unpinned execution point for a tool that can reveal wallet configuration. In this context, any malicious update could expose sensitive material or alter output to mislead operators about wallet state.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

This stop command still fetches and runs the current npm version unless cached locally, so even lifecycle operations are exposed to supply-chain substitution. Given the daemon persists wallet data and controls funds, malicious code at shutdown/startup could tamper with or exfiltrate secrets.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

Reinitialization via unpinned npx again places a critical wallet operation behind live registry resolution. Because this command recreates wallet state after deletion, a hostile package version could generate attacker-known seeds or falsify initialization behavior.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

An unpinned balance command appears low-risk functionally, but it still executes arbitrary package code before returning data. In a wallet context, any command invocation is a code-execution opportunity with access to local secret material and payment history.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Invoice generation via floating npx allows unreviewed code to run during a financial operation. A compromised release could embed attacker-controlled routing, leak metadata, or alter invoice creation in ways that redirect or surveil payments.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

This variable-amount invoice example executes the latest npm package at runtime. Because the tool is a long-running wallet daemon tied to real funds, even simple payment-receive flows can become compromise points through supply-chain attacks.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Custom-description invoice creation still suffers from the same unpinned runtime dependency problem. The financial context makes this materially dangerous because package compromise can lead to theft, tracking, or local secret disclosure rather than merely incorrect output.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Generating reusable BOLT12 offers through a floating package version exposes persistent payment endpoints to potentially malicious code. A bad release could create deceptive offers, leak identifiers, or manipulate wallet behavior over time.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The send-payment example is especially sensitive because it authorizes outbound value transfer. If the executed npm package is replaced or trojanized, an attacker can directly redirect payments, drain balances, or exfiltrate the mnemonic.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

Payment history queries also execute package code and may expose transaction metadata if a hostile release is run. The impact is somewhat lower than direct send/init commands, but still meaningful because the package has access to wallet files and operational state.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

Status checks look harmless, but they still invoke the package and therefore inherit the same supply-chain risk. In this skill, even metadata operations can be abused to launch or alter the local daemon and inspect persisted wallet state.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The upgrade section explicitly uses floating execution to pull the newest version, normalizing unsafe update behavior for a wallet package. This creates a high-value supply-chain target because users are told to trust whatever is latest before operating a daemon that holds real funds.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Starting the daemon via unpinned npx after an upgrade means the most security-sensitive service entrypoint runs code obtained dynamically from npm. A malicious release could establish persistence, expose the daemon beyond localhost, or steal the mnemonic on startup.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation says init --show returns the mnemonic, then later says the mnemonic is redacted. For a wallet that stores a live BIP39 seed, ambiguity about whether a command reveals secrets can cause accidental disclosure into logs, chat transcripts, terminals, or agent memory.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The usage note says to 'use ₿ prefix with sats' and contrasts it against an alternative format, which imposes a specific output convention in natural language. Under the policy rule, forcing a specific language/locale-style convention without opt-in can be a natural-language policy issue.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.