Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Breach tx vulnerability & CPFP attack

4 messages, Mar 28 to 29, 2016. Started by Jérôme Legoupil.

Jérôme Legoupil, David A. Harding, Rusty Russell, Jannes Faber

Permalink First message in the Wayback Machine

Jérôme Legoupil permalink original

Alice has a channel with Bob, lets say 50BTC on each side, and after some time, the channel ends up with 100BTC in Bob’s favour (so Alice has 0BTC in that channel)

Alice broadcasts the obsolete 50/50BTC commitment tx as well as her revocable tx : Multisig tx -> Alice 50BTC, OP_CSV.

When Bob sees that, he broadcasts his breach tx, put it’s not being picked up in blocks. Why ? Alice followed up by broadcasting (or privately sending to major pools) the tx : Alice 50BTC -> Alice 25BTC. She is offering miners to share Bob’s 50BTC with her.

Alice has nothing to lose behaving this way since she had nothing left in the channel anyways and miners have a strong financial incentive to wait and hope to include Alice’s 25BTC offer instead of including Bob’s worthless breach tx.

—

To defend against this attack Bob should do 1) and 2) :

1) Bob should not allow any of his channels to drop below some certain amount, like 10% or something, in order to keep some garanty from Alice, so she won’t have an incentive to behave maliciously. Unfortunately this reduces the channels efficiency but I think this example shows exhausted channels are insecure.
2) Bob should monitor the blockchain permanently and as soon as he detects an obsolete commitment that is confirmed, he should immediately broadcast his breach tx and he should assume Alice is offering miners to collude with her. Therefore, he should engage ASAP in a scorched earth policy by broadcasting a replace-by-fee CPFP tx to himself, offering Alice’s share to miners. He can increase the fee until it is picked up. He has an advantage over Alice during the contest period but his advantage diminishes as the contest period comes near the end. If he wins, Alice loses her 10%, but 10% may not be enough to outbid Alice and Bob may end up losing money.
3) Bob has better chances to win at a lesser cost, the longer the contest period is. If the channel contains high values, the contest period could be chosen higher than usual at setup to make it more secure.

I am not sure this defense is really convincing but that’s the best I could come up with. Any thoughts ?

Jérôme

David A. Harding in reply to Jérôme Legoupil permalink original

On Mon, Mar 28, 2016 at 11:19:42AM +0200, Jérôme Legoupil wrote:

Quoted text (3 lines)
> miners have a strong financial incentive to wait and hope to
> include Alice’s 25BTC offer instead of including Bob’s
> worthless breach tx.

I think you're treating miners here as a single actor when they should be treated as multiple independent actors competing against each other. Bob can have his breach transaction included in a block immediately but the sequence lock on the 50 BTC Alice stole prevents her from spending it for perhaps hundreds of blocks (I believe the paper uses a value of 1,500 blocks).

This means each miner on the network has a choice:

1. Attempt to mine Bob's transaction immediately to claim its modest fee
   before some other miner claims that fee.
2. Hope no one else mines Bob's transaction for several hundred blocks
   and then compete with all other miners to attempt to mine Alice's
   high-fee transaction.

If the network is functioning correctly (e.g. no miner or mining cartel has a majority of hash rate) then all miners should consider option #1 to be the more profitable option for them on average.

-Dave

Rusty Russell in reply to Jérôme Legoupil permalink original

Jérôme Legoupil <jjlegoupil at gmail.com> writes:

Quoted text (5 lines)
> Alice has a channel with Bob, lets say 50BTC on each side, and after some time, the channel ends up with 100BTC in Bob’s favour (so Alice has 0BTC in that channel)
>
> Alice broadcasts the obsolete 50/50BTC commitment tx as well as her revocable tx : Multisig tx -> Alice 50BTC, OP_CSV.
>
> When Bob sees that, he broadcasts his breach tx, put it’s not being picked up in blocks. Why ? Alice followed up by broadcasting (or privately sending to major pools) the tx : Alice 50BTC -> Alice 25BTC. She is offering miners to share Bob’s 50BTC with her.

Hi Jerome!

        Nasty.  Fortunately, this attack doesn't work very well without
a mining cartel (though it's a very acute demonstration of why
censorship avoidance is important!).
        For miner M, Alice's tx is worth 25BTC * P(M mines block) *
P(nobody else mines Bob's tx).  If we assume everyone is locally
profit maximizing, that last term depends on how many small miners
there are (a 0.1% miner might see Alice's tx as worth 0.025 BTC, but
they're individually not likely to get a block in the 36-block CSV
window).

Peter Todd once said small miners are more important than big miners (maybe it was in person; I can't find it with a quick google). This is why.

Cheers, Rusty.

Jannes Faber in reply to Rusty Russell permalink original

On 29 Mar 2016 2:15 a.m., "Rusty Russell" <rusty at rustcorp.com.au> wrote:

Quoted text (3 lines)
> Peter Todd once said small miners are more important than big miners
> (maybe it was in person; I can't find it with a quick google).  This
> is why.

Peter Todd:

Quoted text (1 line)
> So, why do we give miners transaction fees anyway? Well, they are

providing a service of "mining a block", but the *real* service they are providing is the service of being independent from other miners, and we value that because we don't want >50% of the hashing power to be controlled by any one entity.

Quoted text (2 lines)
>
> When you say these small miners are inefficient, you're completely

ignoring what we actually want miners to do, and that is to provide *independent* hashing power. The small miners are the most efficient at providing this service, not the least.

Very interesting and very relevant (even 3 years later) thread overall: https://bitcointalk.org/index.php?topic=144895.10