Disclosure: LND Excessive Failback Exploit

Posted by morehouse

Mar 4, 2025/15:58 UTC

In a detailed analysis of a critical vulnerability within the Lightning Network Daemon (LND) version 0.17.5 and below, it was revealed that an exploit exists in the on-chain resolution logic, potentially allowing attackers to misappropriate funds. This bug hinges on a specific situation where, during the update process of commitment transactions—which are essential for reflecting the current state of lightning channel balances—an attacker can manipulate the transaction process to their advantage. The issue arises from how LND handled the failback of Hashed Time-Locked Contracts (HTLCs), which are mechanisms used for securing payments across the network until conditions are met.

The core of the bug, termed the "Excessive Failback Bug," involves LND's mechanism for dealing with HTLCs that are present on one commitment transaction but absent on another due to the counterparties holding two valid commitments momentarily. Specifically, if an HTLC is marked as missing from the confirmed commitment, LND would erroneously attempt to fail back the HTLC upstream, even if the preimage of the HTLC (proof that the payment was made to the recipient) had been revealed. This incorrect failback could lead to scenarios where a node loses the value of the HTLC because it would be claimed by the downstream node while being refunded to the upstream node, effectively doubling the expenditure.

The exploitation scenario described involves a coordinated attack where the attacker controls two nodes around the victim node. Through a series of steps involving offline nodes, refusal to revoke previous commitments, and force-closing channels, the attacker can trigger the failback bug. Crashing the victim node to force a restart allows the attacker to capitalize on the bug, as the incorrect failback occurs upon reloading HTLC resolution data from the database, leading to the theft of the HTLC value.

This vulnerability was rectified in LND 0.18.0 through a subtle yet significant modification to the failback logic, ensuring that HTLCs for which the preimage is known are not failed back. This fix was part of a broader rewrite of LND's sweeper system and underscores the importance of updating nodes to the latest software versions to safeguard against such exploits.

The discovery and subsequent resolution of this bug highlight a critical oversight in the BOLT specifications governing the Lightning Network. Although similar issues were independently identified and addressed by other lightning implementations such as CLN, eclair, and LDK through the introduction of preimage checks in their failback logic, the BOLT specifications remained unchanged. This lack of specification update points to a broader challenge within decentralized protocol development, where the discovery of implementation-specific bugs does not always translate into collective security improvements across all implementations.

The incident serves as a reminder of the significance of keeping both software and specifications up-to-date, not only to prevent exploitable vulnerabilities but also to ensure that collective knowledge gained from addressing such issues benefits the entire ecosystem. For node operators, the key takeaway is to upgrade to at least LND 0.18.0 to mitigate the risk posed by this now-patched vulnerability, reinforcing the ongoing need for vigilance and proactive security practices within the blockchain and cryptocurrency domains.

Link to Raw Post
Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from authoritative bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiBitcoin Transcripts Review
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project?

Give Feedback