← MCP server and skill grades

mcp

getAlby/mcp

C
Type
MCP server
Scanned
Nov 17, 2026
Version
1df86cca5733
Files read
37

This MCP server connects an AI agent to a Bitcoin Lightning wallet via Nostr Wallet Connect to check balances, manage invoices, send payments, and fetch paid web resources. Its biggest risk is financial loss and internal network exposure, because fetch_l402 automatically pays any invoice amount a remote server demands with no spending limit, and request_invoice can be tricked into making requests to local or private network addresses.

What it can reach

Other
Controls the connected Bitcoin Lightning wallet account, including reading balances and transaction history, creating invoices, and sending irreversible Bitcoin payments.
Secrets
Reads NWC_CONNECTION_STRING (the wallet's Nostr Wallet Connect secret) and server settings from environment variables, or from HTTP Authorization headers and nwc query parameters when running in HTTP mode.
Files
Reads environment variables from a .env file in the current working directory at startup.
Network
Connects to Nostr relays for wallet operations, makes outbound HTTP requests to L402 endpoints, Lightning Address servers, and exchange-rate APIs, and listens on TCP port 3000 (127.0.0.1 by default, or all interfaces in Docker) when MODE=HTTP is enabled.

Findings

1 high2 medium2 low
  1. HighUncapped automatic Bitcoin payment on HTTP 402 responses in fetch_l402

    src/tools/lightning/fetch_l402.ts:58

    When fetch_l402 requests a URL that responds with HTTP 402 Payment Required, l402.fetchWithL402 immediately pays whatever BOLT-11 invoice the remote server places in its WWW-Authenticate header, with no maximum amount parameter and without showing the price to the user or AI agent first. Even when a user intentionally asks to fetch a resource expecting a tiny microtransaction, a malicious or compromised server can return an invoice for the wallet's entire available balance (subject only to any wallet-side NWC budget) and drain funds irreversibly in one call.

    Fix: Add a required max_amount_in_sats (or small default cap) parameter to fetch_l402 and wrap the webln.sendPayment call to parse the BOLT-11 invoice and reject any payment that exceeds the allowed maximum.

  2. MediumUnauthenticated SSE message endpoint and session hijacking in HTTP mode

    src/sse.ts:61

    When the server is started with MODE=HTTP (the default in the provided Dockerfile), POST /messages looks up an active wallet session solely by req.query.sessionId without checking the caller's NWC authorization secret. In addition, GET /sse lets any caller register a custom req.query.sessionId key (which can set a predictable ID or overwrite another user's session) and never deletes sessions when connections close, allowing anyone who obtains, predicts, or fixes a sessionId to call pay_invoice against the victim's wallet.

    Fix: Require and verify the same NWC secret on POST /messages as on GET /sse, remove support for client-supplied req.query.sessionId on GET /sse, store sessions in a Map, and delete and close the session on res.on('close').

  3. MediumServer-side request forgery (SSRF) via Lightning Address resolution in request_invoice

    src/tools/lightning/request_invoice.ts:39

    Unlike fetch_l402, the request_invoice tool does not validate target addresses with assertPublicUrl or disable HTTP redirects. If an agent is tricked by prompt injection into calling request_invoice with an attacker-controlled Lightning Address (user@attacker.com), ln.fetch() follows HTTP redirects and reads an attacker-supplied callback URL from the LNURL response, which ln.requestInvoice then fetches directly even if it points to 127.0.0.1, private LAN hosts, or cloud metadata endpoints (169.254.169.254).

    Fix: Validate both the initial .well-known/lnurlp URL and the returned callback URL with assertPublicUrl, and perform both fetches with redirect: 'error' and a pinned DNS lookup.

  4. LowDNS rebinding can bypass SSRF filtering in fetch_l402

    src/security.ts:119

    assertPublicUrl resolves the hostname with dns.lookup to block loopback, link-local, and private IPs, but l402.fetchWithL402 subsequently calls fetch with the original URL, causing a second independent DNS lookup. If an agent is tricked into calling fetch_l402 on an attacker-controlled domain with a zero-TTL DNS record, the server can resolve to a public IP during the check and to 127.0.0.1 or 169.254.169.254 during the fetch, returning the internal HTTP response body to the agent.

    Fix: Use a custom undici Agent dispatcher with a connect.lookup callback that validates the resolved IP address with isPublicAddress at socket connection time so DNS is only resolved once.

  5. LowWallet spending secret accepted in URL query parameters in HTTP mode

    src/auth.ts:30

    In HTTP mode, getConnectionSecret accepts the nostr+walletconnect:// URI (which contains the private key authorizing wallet payments) via the nwc URL query parameter, and the README demonstrates configuring clients this way. Query strings are routinely recorded in plaintext in reverse proxy, load balancer, and client logs, which can expose full spending access to the wallet.

    Fix: Accept the NWC secret only via the Authorization: Bearer request header by default, or gate query-parameter authentication behind an explicit opt-in flag with a clear warning about URL logging.