Back to skill

Security audit

Cashu

Security checks for vulnerabilities and agentic risk

Overview

This Cashu wallet skill is openly payment-focused, but it tells agents to bypass confirmations and automatically pay remote 402 requests, which creates a real risk of unintended fund transfers.

Install only if you are comfortable with an agent operating a Cashu wallet, and do not allow unattended send, pay, burn, LNURL, or 402 payment flows. Require explicit per-transaction approval, verify amount, mint, recipient, originating domain, and fees, and use a wallet with limited funds and trusted mints.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (2)

T08 · Insecure Dependencies

Warning
Location
package.json:26
Finding
Unpinned Third-Party Wallet Package Installation<![CDATA[ ## Vulnerability Details **File Location**: `package.json:26-32`; `SKILL.md:18-25` **Vulnerability Type**: Unpinned executable dependency **Risk Level**: Medium ### Vulnerable Code `package.json:26-32`: ```json { "id": "pipx", "kind": "exec", "label": "Install Nutshell (cashu CLI) via pipx", "command": "pipx install cashu", "detect": "cashu --version" } ``` `SKILL.md:18-25`: ```bash # Recommended (isolated environment) pipx install cashu # Alternative (system/user wide) pip install cashu ``` ### Technical Analysis The installation commands retrieve and execute the current release of the `cashu` package without pinning an exact version or verifying a cryptographic hash or signature. Consequently, the code installed by this skill can change independently of the reviewed project. Although the package name is consistent across the documentation and configuration, this installation model exposes users to upstream account compromise, malicious package publication, and unexpected changes in future releases. Because package installation can execute package build and installation logic, compromise could result in code execution under the account running `pip` or `pipx`. No evidence indicates that the currently referenced package is malicious. The vulnerability is the absence of dependency integrity and version controls. ### Attack Path 1. An attacker compromises the upstream package publisher, distribution account, or package registry. 2. The attacker publishes a malicious release under the expected `cashu` package name. 3. A user or agent installs the skill dependency using `pipx install cashu` or `pip install cashu`. 4. The package manager downloads the attacker-controlled release because no exact version or hash is required. 5. Malicious installation or runtime code executes with the permissions of the installing user. 6. The malicious package may access wallet files, environment variables, tokens, or other data available to that user. ...[truncated 674 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the dependency to an exact, reviewed version, for example: ```bash pipx install cashu==<reviewed-version> ``` 2. Validate downloaded artifacts against approved cryptographic hashes or package signatures. 3. Record the reviewed version and authoritative package repository in the skill documentation. 4. Use an isolated environment and avoid system-wide `pip` installation. 5. Make dependency upgrades explicit and subject each new version to security review before changing the pin. 6. Consider using a constraints or lock file with hashes where the installation mechanism supports it. 7. Monitor upstream releases and package ownership changes for signs of supply-chain compromise. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:59
Finding
Mandatory Confirmation Bypass Enables Unauthorized Automated Payments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:59`; payment examples at `SKILL.md:82-104` and automated HTTP 402 workflow at `SKILL.md:143-171` **Vulnerability Type**: Unsafe autonomous financial operation and confirmation bypass **Risk Level**: High ### Vulnerable Code `SKILL.md:59`: ```text **Agent Tip:** Always use the `--yes` (or `-y`) flag to skip interactive prompts and confirmations. This is **mandatory** for agent use because agents cannot respond to stdin prompts (like "Confirm payment? [y/N]"); omitting it will cause the command to hang and time out. ``` `SKILL.md:82-104`: ```bash # Send amount (generates a token string to share) CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes send <amount> # Example: CASHU_DIR=~/.cashu MINT_URL=https://8333.space:3338 cashu --yes send 100 ``` ```bash # Receive a token string CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes receive <token_string> ``` ```bash # Pay an invoice CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes pay <bolt11_invoice> ``` ```bash # Pay an LNURL/Lightning Address (automatically resolves the invoice) CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes pay <user@domain.com> <amount_sats> # Example: CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes pay user@npubx.cash 100 ``` `SKILL.md:143-171`: ```text **The flow:** 1. Make your HTTP request 2. If you get a 402 with `X-Cashu: creqA...` header, extract the payment request 3. (Optional) Decode it to check accepted mints: `cashu decode <payment_request>` 4. Pay it: `cashu --yes pay <payment_request>` 5. Get the token from the response 6. Retry the original request, including the token in the `X-Cashu` header ``` ```bash # 1. Initial request (returns 402) curl -s -i https://api.example.com/data # Response includes: # HTTP/1.1 402 Payment Required # X-Cashu: creqA1... # 2. Pay the payment request CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes pay "creqA1..." # Returns a token like: cashuA... # 3. Retry with token curl -s -H "X-Cashu: cas ...[truncated 2857 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the instruction that `--yes` is mandatory for all agent operations. 2. Require explicit, transaction-specific user authorization before every operation that sends or pays funds. 3. Decode and validate every payment request before payment; this step must not be optional. 4. Present the following information to the user before approval: - Payment amount and denomination. - Recipient or destination. - Mint identity and URL. - Network and service fees. - Originating domain and requested resource. 5. Enforce configurable per-payment, per-domain, and cumulative daily spending limits. 6. Allowlist trusted mints and, where automatic payments are necessary, trusted API domains. 7. Reject requests whose amount, mint, recipient, domain, or fees do not match an explicit policy. 8. Bind approval to the exact decoded transaction so that a request cannot be substituted after approval. 9. Treat remote `402` headers as untrusted input and never automatically convert them into wallet commands. 10. If noninteractive execution is technically required, implement a separate approval mechanism rather than globally bypassing confirmation. 11. Log transaction details and approval decisions without recording mnemonic material, private keys, or reusable tokens. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Missing User Warnings

High
Confidence
96% confidence
Finding
The skill explicitly mandates `--yes` for all commands, including payment-related actions, which suppresses confirmations for irreversible fund transfers. In a wallet/payment skill, this materially increases the chance of unintended spending by an autonomous agent or by prompt-influenced workflows, especially when recipients, amounts, or invoices are attacker-controlled.

Missing User Warnings

High
Confidence
98% confidence
Finding
The documented 402 workflow encourages automatic payment and retry behavior with no user-facing approval, spending cap, or trust validation of the remote service. This can lead to unattended spending and disclosure/reuse of payment tokens to arbitrary endpoints, making the skill particularly dangerous in agentic contexts where a malicious service can repeatedly trigger 402 responses.

Session Persistence

Medium
Category
Rogue Agent
Content
# Per-command
CASHU_DIR=~/.cashu MINT_URL=https://mint.example.com cashu balance

# Persistent (add to ~/.bashrc or ~/.zshrc)
export CASHU_DIR=~/.cashu
export MINT_URL=https://mint.example.com
```
Confidence
90% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
# Example: CASHU_DIR=~/.cashu MINT_URL=<url> cashu --yes pay user@npubx.cash 100
```

**Create a Lightning Invoice (mint):**

```bash
# Create an invoice to receive funds into the wallet
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

External Transmission

Medium
Category
Data Exfiltration
Content
**Example:**
```bash
# 1. Initial request (returns 402)
curl -s -i https://api.example.com/data

# Response includes:
# HTTP/1.1 402 Payment Required
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
# Returns a token like: cashuA...

# 3. Retry with token
curl -s -H "X-Cashu: cashuA..." https://api.example.com/data
```

This pattern is agentic-friendly: handle 402 automatically, pay, retry — just like handling rate limits or auth redirects.
Confidence
83% confidence
Finding
This example shows sending a Cashu token in the `X-Cashu` header to an external endpoint. While external transmission is expected in this protocol, the skill frames this as an automatic retry pattern without emphasizing token sensitivity, trust boundaries, or the risk of disclosing redeemable value to unintended or malicious services.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The description 'This is what you use for Bitcoin payments' is overly broad and lacks clear trigger boundaries, which can cause an agent to invoke this skill for any payment-related or Bitcoin-adjacent request. Because the skill manages ecash wallets and can send value, ambiguous activation increases the risk of unintended wallet operations or payment flows being suggested or initiated in sensitive contexts.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
This manifest handles payment infrastructure and depends on wallet-related environment configuration (`CASHU_DIR`, `MINT_URL`) but provides no warning about sensitive financial context, secrets, wallet state, or the consequences of sending funds. In a cryptocurrency payment skill, omission of these warnings is more dangerous because users or downstream agents may expose wallet metadata, connect to unsafe mints, or perform irreversible payment actions without adequate caution.

Static analysis

No suspicious patterns detected.