You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
btcpayserver: the clightning backend grants BTCPay full lightningd RPC over the unix socket #87
With services.btcpayserver.lightningBackend = "clightning", BTCPay Server talks to lightningd over the unix socket (modules/btcpayserver.nix line 216: btclightning=type=clightning;server=unix:///.../lightning-rpc). The socket is rpc-file-mode=0660, and btcpayserver joins clightning's group for it (line 271). The socket has no command restriction. So the btcpayserver process can call every lightningd RPC: withdraw, pay, fundchannel, close, dev-* if enabled.
BTCPay Server is a web application. It's often exposed to the internet, by design, and its web UI can install plugins at runtime. A bug in BTCPay, a malicious plugin, or a stolen admin session therefore gives full control of the lightningd wallet. The lnd backend is in a better position: btcpayserver.nix mints a custom macaroon with a permission list for it (services.lnd.macaroons.btcpayserver).
What would narrow it
Connect BTCPay to clightning through clnrest with a rune that lists only the methods BTCPay needs (invoice, listinvoices, waitinvoice, pay for refunds if used, getinfo). BTCPay Server supports a clnrest/rune connection string in recent versions. This needs a check against the pinned version.
If the unix socket must stay, document in docs/services.md that this backend grants BTCPay full control of the lightningd wallet, so operators can choose lnd with the restricted macaroon when BTCPay is public.
How found
LLM review (Kimi K3 max, confirmed by GLM 5.3 max) flagged this. I verified it against the code. Severity: medium to high, depends on the exposure of the BTCPay web UI.
I checked BTCPay Server's Lightning library. BTCPay Server 2.4.7 uses BTCPayServer.Lightning 1.7.14. Its Core Lightning client connects only through JSON-RPC over the lightning-rpc socket or TCP. It has no clnrest client and can't send a rune, and its master branch is the same today. So the clnrest idea above doesn't work with the pinned version.
#274 documents the access, so operators can choose lnd when BTCPay Server is public.
I believe there are two ways to restrict it.
Put a small proxy in front of lightning-rpc that passes only the methods BTCPay Server needs. Receiving payments needs invoice, listinvoices, waitanyinvoice, getinfo and delinvoice. The Lightning node page and payouts need more, including xpay.
Add clnrest and rune support to BTCPayServer.Lightning upstream. Then bitcoinix can connect BTCPay Server through clnrest with a restricted rune.
Activity
ostermayer commentedon Nov 16, 2026
I checked BTCPay Server's Lightning library. BTCPay Server 2.4.7 uses BTCPayServer.Lightning 1.7.14. Its Core Lightning client connects only through JSON-RPC over the
lightning-rpcsocket or TCP. It has no clnrest client and can't send a rune, and its master branch is the same today. So the clnrest idea above doesn't work with the pinned version.#274 documents the access, so operators can choose lnd when BTCPay Server is public.
I believe there are two ways to restrict it.
lightning-rpcthat passes only the methods BTCPay Server needs. Receiving payments needsinvoice,listinvoices,waitanyinvoice,getinfoanddelinvoice. The Lightning node page and payouts need more, includingxpay.btcpayserver: document that the clightning backend controls the node'…
btcpayserver: document that the clightning backend controls the node'…
clightning: make the data dir not writable by its group (#272)