Rusty Russell [ARCHIVE] on Nostr: ๐
Original date posted:2020-02-21 ๐ Original message: Anthony Towns <aj at ...
๐
Original date posted:2020-02-21
๐ Original message:
Anthony Towns <aj at erisian.com.au> writes:
> On Tue, Feb 18, 2020 at 10:23:29AM +0100, Joost Jager wrote:
>> A different way of mitigating this is to reverse the direction in which the
>> bond is paid. So instead of paying to offer an htlc, nodes need to pay to
>> receive an htlc. This sounds counterintuitive, but for the described jamming
>> attack there is also an attacker node at the end of the route. The attacker
>> still pays.
>
> I think this makes a lot of sense. I think the way it would end up working
> is that the further the route extends, the greater the payments are, so:
>
> A -> B : B sends A 1msat per minute
> A -> B -> C : C sends B 2msat per minute, B forwards 1msat/min to A
> A -> B -> C -> D : D sends C 3 msat, etc
> A -> B -> C -> D -> E : E sends D 4 msat, etc
>
> so each node is receiving +1 msat/minute, except for the last one, who's
> paying n msat/minute, where n is the number of hops to have gotten up to
> the last one. There's the obvious privacy issue there, with fairly
> obvious ways to fudge around it, I think.
Yes, it needs to scale with distance to work at all. However, it has
the same problems with other upfront schemes: how does E know to send
4msat per minute?
> I think it might make sense for the payments to have a grace period --
> ie, "if you keep this payment open longer than 20 seconds, you have to
> start paying me x msat/minute, but if it fulfills or cancels before
> then, it's all good".
But whatever the grace period, I can just rely on knowing that B is in
Australia (with a 1 second HTLC commit time) to make that node bleed
satoshis. I can send A->B->C, and have C fail the htlc after 19
seconds for free. But B has to send 1msat to A. B can't blame A or C,
since this attack could come from further away, too.
This attack always seems possible. Are you supposed to pay immediately
to fail an HTLC? That makes for a trivial attack, so I guess not.
And if there is a grace period, I can just gum up the network with lots
of slow-but-not-slow-enough HTLCs.
> Maybe this also implies a different protocol for HTLC forwarding,
> something like:
>
> 1. A sends the HTLC onion packet to B
> 2. B decrypts it, makes sure it makes sense
> 3. B sends a half-signed updated channel state back to A
> 4. A accepts it, and forwards the other half-signed channel update to B
>
> so that at any point before (4) Alice can say "this is taking too long,
> I'll start losing money" and safely abort the HTLC she was forwarding to
> Bob to avoid paying fees; while only after (4) can she start the time on
> expecting Bob to start paying fees that she'll forward back. That means
> 1.5 round-trips before Bob can really forward the HTLC on to Carol;
> but maybe it's parallelisable, so Bob/Carol could start at (1) as soon
> as Alice/Bob has finished (2).
We added a ping-before-commit[1] to avoid the case where B has disconnected
and we don't know yet; we have to assume an HTLC is stuck once we send
commitment_signed. This would be a formalization of that, but I don't
think it's any better?
There's an old proposal to fast-fail HTLCs: Bob sends an new message "I
would fail this HTLC once it's committed, here's the error" and if Alice
gets it before she sends the commitment_signed, she sends a new
"unadd_htlc" message first. This theoretically allows Bob to do the
same: optimistically forward it, and unadd it if Alice doesn't commit
with it in time.[2]
Cheers,
Rusty.
[1] Technically, if we haven't seen any traffic from the peer in the
last 30 seconds, we send a ping and wait.
[2] This seems like a speedup, but it only is if someone fails the HTLC.
We still need to send the commitment_signed back and forth (w/
revoke and ack) before committing to it in the next hop.
Published at
2023-06-09 12:58:57Event JSON
{
"id": "cdc286816aa9c88b63c6cbc45e077ef19af0406078d294ec6fbc329e87f6def1",
"pubkey": "13bd8c1c5e3b3508a07c92598647160b11ab0deef4c452098e223e443c1ca425",
"created_at": 1686315537,
"kind": 1,
"tags": [
[
"e",
"45cf63b0d2d71c68e5ad79035b26c58f0d0a7f08c912c1e3fb49d13bc9edb573",
"",
"root"
],
[
"e",
"97be8ea28f35dc1a4c5026fda0756eff356bfe78c84add783d6471fa1319d86e",
"",
"reply"
],
[
"p",
"f0feda6ad58ea9f486e469f87b3b9996494363a26982b864667c5d8acb0542ab"
]
],
"content": "๐
Original date posted:2020-02-21\n๐ Original message:\nAnthony Towns \u003caj at erisian.com.au\u003e writes:\n\u003e On Tue, Feb 18, 2020 at 10:23:29AM +0100, Joost Jager wrote:\n\u003e\u003e A different way of mitigating this is to reverse the direction in which the\n\u003e\u003e bond is paid. So instead of paying to offer an htlc, nodes need to pay to\n\u003e\u003e receive an htlc. This sounds counterintuitive, but for the described jamming\n\u003e\u003e attack there is also an attacker node at the end of the route. The attacker\n\u003e\u003e still pays.\n\u003e\n\u003e I think this makes a lot of sense. I think the way it would end up working\n\u003e is that the further the route extends, the greater the payments are, so:\n\u003e\n\u003e A -\u003e B : B sends A 1msat per minute\n\u003e A -\u003e B -\u003e C : C sends B 2msat per minute, B forwards 1msat/min to A\n\u003e A -\u003e B -\u003e C -\u003e D : D sends C 3 msat, etc\n\u003e A -\u003e B -\u003e C -\u003e D -\u003e E : E sends D 4 msat, etc\n\u003e\n\u003e so each node is receiving +1 msat/minute, except for the last one, who's\n\u003e paying n msat/minute, where n is the number of hops to have gotten up to\n\u003e the last one. There's the obvious privacy issue there, with fairly\n\u003e obvious ways to fudge around it, I think.\n\nYes, it needs to scale with distance to work at all. However, it has\nthe same problems with other upfront schemes: how does E know to send\n4msat per minute?\n\n\u003e I think it might make sense for the payments to have a grace period --\n\u003e ie, \"if you keep this payment open longer than 20 seconds, you have to\n\u003e start paying me x msat/minute, but if it fulfills or cancels before\n\u003e then, it's all good\".\n\nBut whatever the grace period, I can just rely on knowing that B is in\nAustralia (with a 1 second HTLC commit time) to make that node bleed\nsatoshis. I can send A-\u003eB-\u003eC, and have C fail the htlc after 19\nseconds for free. But B has to send 1msat to A. B can't blame A or C,\nsince this attack could come from further away, too.\n\nThis attack always seems possible. Are you supposed to pay immediately\nto fail an HTLC? That makes for a trivial attack, so I guess not.\n\nAnd if there is a grace period, I can just gum up the network with lots\nof slow-but-not-slow-enough HTLCs.\n\n\u003e Maybe this also implies a different protocol for HTLC forwarding,\n\u003e something like:\n\u003e\n\u003e 1. A sends the HTLC onion packet to B\n\u003e 2. B decrypts it, makes sure it makes sense\n\u003e 3. B sends a half-signed updated channel state back to A\n\u003e 4. A accepts it, and forwards the other half-signed channel update to B\n\u003e\n\u003e so that at any point before (4) Alice can say \"this is taking too long,\n\u003e I'll start losing money\" and safely abort the HTLC she was forwarding to\n\u003e Bob to avoid paying fees; while only after (4) can she start the time on\n\u003e expecting Bob to start paying fees that she'll forward back. That means\n\u003e 1.5 round-trips before Bob can really forward the HTLC on to Carol;\n\u003e but maybe it's parallelisable, so Bob/Carol could start at (1) as soon\n\u003e as Alice/Bob has finished (2).\n\nWe added a ping-before-commit[1] to avoid the case where B has disconnected\nand we don't know yet; we have to assume an HTLC is stuck once we send\ncommitment_signed. This would be a formalization of that, but I don't\nthink it's any better?\n\nThere's an old proposal to fast-fail HTLCs: Bob sends an new message \"I\nwould fail this HTLC once it's committed, here's the error\" and if Alice\ngets it before she sends the commitment_signed, she sends a new\n\"unadd_htlc\" message first. This theoretically allows Bob to do the\nsame: optimistically forward it, and unadd it if Alice doesn't commit\nwith it in time.[2]\n\nCheers,\nRusty.\n\n[1] Technically, if we haven't seen any traffic from the peer in the\n last 30 seconds, we send a ping and wait.\n\n[2] This seems like a speedup, but it only is if someone fails the HTLC.\n We still need to send the commitment_signed back and forth (w/\n revoke and ack) before committing to it in the next hop.",
"sig": "d0a127063c20c995969daaedbfa0435366b32852f8259f1ae33be76675f0611e7f3e9a0356d6e10954dcde81a68d9e109b73cd4a4bd7ab5108ccccff10f19d06"
}