bitcoin-dev

A Free-Relay Attack Exploiting RBF Rule #6

A Free-Relay Attack Exploiting RBF Rule #6

Original Postby Peter Todd

Posted on: March 18, 2024 13:21 UTC

Replace-by-Fee (RBF) Rule 6 plays a critical role in the economic incentives of Bitcoin transactions, ensuring that miners are more likely to choose transactions with a higher fee rate over those with lower rates, even if the latter offer a higher absolute fee.

This rule was included in the original Full-RBF opt-in pull request but was omitted from BIP-125 by oversight. RBF Rule 6 introduces a path dependency where the order in which transactions are received affects their acceptance, paving the way for potential free-relay attacks.

One such attack involves creating two transactions: a large transaction A with a low fee rate but high absolute fee, and a smaller transaction B with a high fee rate but low absolute fee. These are broadcasted simultaneously to different nodes. Due to RBF rules, nodes prioritize transactions based on the sequence of receipt and fee rate, leading to a scenario where bandwidth is consumed without achieving transaction finality. An attacker can exploit this by continuously creating transactions similar to A with slightly higher fees to consume network bandwidth, banking on the probability that these transactions will not be mined unless they reach a competitive fee-rate.

Mitigations against such attacks include the implementation of Replace-by-Fee-Rate (RBFR), which limits the range of fee-rate deltas by requiring a significant increase in fee rate for a transaction to replace another. This approach has shown real-world efficacy, as evidenced by preliminary data suggesting that a considerable proportion of RBFR replacements are mined despite mempool inconsistencies. However, enforcing a strict fee-rate increase ratio could potentially disrupt many existing wallet applications that adjust fees based on minimal increments.

The viability of free-relay attacks not only highlights vulnerabilities within the current system but also underscores the potential benefits of adopting RBFR mechanisms. By necessitating a higher fee rate for transaction replacement, RBFR can mitigate wasteful bandwidth consumption and promote more economically rational mining practices. Despite the challenges posed by such an adjustment, the underlying economics suggest a strong case for its implementation.

Discussions around these issues have been made public following disclosure to bitcoin-security, with no objections raised against publicizing the matter. It's important to note that all forms of free-relay attacks hinge on the attacker having access to sufficient funds to cover potential fees, adding a financial barrier to the execution of such strategies.

For further reading on the subject and related discussions, visit the following links: Original Full-RBF opt-in pull request, One-shot replace-by-fee-rate - the status quo, and Replace-by-fee-rate success rate.