LDK Fixes Lightning Flaw That Could Steal Forwarded Bitcoin

LDK released patches for a flaw that could let a malicious Lightning peer steal a forwarded Bitcoin payment after reconnecting and falsely claiming it missed an update.

Lightning Development Kit (LDK) released versions v0.2.7 and v0.1.13 on Oct. 1 to fix a reconnect flaw in its 0.2 and 0.1 branches. The vulnerability could let a malicious channel peer steal the value of a forwarded Bitcoin payment.

The attack starts when a peer acknowledges a channel update, disconnects and then falsely claims it did not receive the update after reconnecting. Before the fix, LDK could sign a conflicting commitment transaction in response. A commitment transaction records the agreed balance between channel participants and can be used to settle the channel on Bitcoin’s blockchain.

LDK’s channel monitor did not record the conflicting transaction. The monitor tracks the channel states that can be used for on-chain claims. A malicious peer could confirm the transaction, let a forwarded payment reach the next recipient and later reclaim the incoming payment after its contract expired. The forwarding application would then pay the recipient without recovering the corresponding Bitcoin.

The patched software allows a retransmission only while the peer’s acknowledgment is still pending. If a peer claims that an already acknowledged update was missed, LDK now force-closes the channel instead of signing a conflicting state.

Version v0.2.7 also fixes a separate flaw in LSPS2, a Lightning service flow in which a liquidity provider opens a channel while processing a payment. An intercepted payment could report an incorrect amount, causing the service to open a channel and forward more Bitcoin than it received. The service would have to cover the difference from its own funds.

The LSPS2 amount check was fixed in pull request 5042. The reconnect flaw was fixed in pull request 5057. The v0.1.13 release lists the reconnect fix but does not include the LSPS2 correction.

LDK is compiled and run inside wallets and payment applications, so developers must update the library in deployed software. Teams using LSPS2 must also review payment contracts queued by an earlier version because those contracts may contain amounts that were not checked under the corrected rules.

The releases address issues separate from the splice-fee and saved-state loading bugs fixed in LDK v0.2.6.

Articles by this author