Lightning Growth Package (LDK), a library for constructing Bitcoin Lightning wallets and cost purposes, has patched a flaw that might let a malicious channel peer steal the worth of a forwarded cost by mendacity after reconnecting. Affected utility builders want to include the repair into the software program they deploy.
The October 1-dated v0.2.7 and v0.1.13 safety releases handle the LDK reconnect vulnerability on the 0.2 and 0.1 branches, respectively. Bitcoin Optech described the fixes in its Oct. 9 e-newsletter.
How the LDK reconnect flaw might value Bitcoin
The assault begins with a channel peer acknowledging an replace, then reconnecting and pretending it by no means obtained it. Earlier than the repair, that false declare might trigger LDK to signal a conflicting dedication transaction.
A dedication transaction represents a channel’s agreed state and can be utilized to settle it on Bitcoin’s blockchain. Within the state of affairs described in PR 5057, the newly signed transaction was not recorded by LDK’s channel monitor, the part monitoring the channel’s on-chain claims.
That hole might flip a forwarded cost right into a loss. The malicious sender might affirm the transaction on-chain and let the cost settle with the following recipient. It might then reclaim the incoming cost contract when it expired, though the forwarding node knew the key usually used to say cost.
The forwarding utility would have paid downstream with out recovering the corresponding incoming funds. The repair permits retransmission solely whereas the peer’s acknowledgment stays excellent and force-closes the channel when the peer claims an already-acknowledged replace was missed.
Alongside the LDK reconnect repair, model 0.2.7 addresses a distinct theft path involving LSPS2 just-in-time funds, the place a liquidity service opens a channel as a part of dealing with a cost.
An intercepted cost might misrepresent its quantity, inflicting the service to open a channel and ahead extra Bitcoin than the incoming cost provided. The service would cowl the distinction from its personal funds. PR 5042 addresses that quantity verify.
That publicity considerations the LSPS2 service circulate. The v0.1.13 notes checklist the shared reconnect repair with out itemizing the LSPS2 repair.
These defects differ from the splice-fee diversion and saved-state loading bugs lined in mycryptopot’s Sept. 13 LDK v0.2.6 report. Core Lightning is a separate implementation, as described within the replace under.
LDK’s structure documentation explains that the SDK is compiled and executed inside purposes. Builders should incorporate the related patched library code into deployed software program. For LSPS2 integrations, the PR 5042 commit rationalization flags that cost contracts queued by a previous model retain unvalidated quantities; groups must account for these pending contracts in addition to updating the library.