Research/Bitcoin Dev Archive / lightning-dev list
Mitigations for loop attacks
20 messages, May 2 to 23, 2018. Started by Jim Posen.
Jim Posen (8), ZmnSCPxj (6), Rusty Russell (3), Chris Gough (2), Corné Plooy
I have been thinking a lot lately about attacks on lightning routing nodes, the worst of which is the so-called Loop Attack [1]. See the mailing list thread for more details, but the basic idea is that a sender and receiver collude to create a long circuit and refuse to settle or fail the HTLC at the end until the last possible moment. The attack is particularly insidious for a few reasons. Firstly, an attack on a multi-hop route gives the attacker leverage, so that their funds locked in one channel cause funds to be locked up in every channel on the route. Second, the onion routing makes it difficult to attribute blame to a single node and defend against a repeated attack.
First, I'll note that the case where a sender and recipient collude is a more active variant on an attack that any node in a route can perform. Even if a node does not initiate the payment, it can just accept offered HTLCs in the route, not forward them, and wait until the offered HTLC almost expires before failing. As noted above, the prior node in the route cannot determine whether the attacking node is at fault or one downstream from it. Even the sender may not be able to determine where in the route the payment failed because of the issue where the obfuscated error reason is not MAC'ed on every hop.
There are two directions of solutions I have heard: 1) protocol support for decrypting the onion route if the HTLC is kept in-flight for too long 2) requiring fees even if the payment fails as a cost to the attacker 3) some sort of reputation system for nodes.
Option 1 I'm afraid may be quite complex. Say this mechanism kicks in and all nodes in the circuit deobfuscate the route and are able to see the delays at each hop. The outcome we hope for is that there is one node clearly to blame and the prior hop in the route fails all channels with them. However, the attacker can of course control multiple successive hops in the route, one that looks innocent in front of one that looks guilty, then keep the channel alive and try again. So then all nodes need to keep a record of the full circuits and iteratively shift blame up the chain if bad HTLCs keep going through those channels.
Option 2 is also problematic because it only protects against the case where the sender is colluding with the receiver, and not where a routing node is opportunistically delaying payments. This would, however, likely be successful against nodes being annoying and sending tons of payments with randomly generated payment hashes in order to "ping" a circuit.
Option 3 has become my preferred solution. The idea is that that for each node that one has channels with, it only forwards payments through them if they have a good history, otherwise it fails the payment. Notably, we ignore whether the downstream hop is directly responsible for delaying a payment or whether they are simply willing to forward to another node that is intentionally delaying -- both should be considered bad behavior. In my opinion, this type of solution fits best into the Lightning model of independent, linked channels where each node has private contracts with its direct peers. It also is the simplest in the context of onion routing because if you are offered an HTLC to route, the only decision you can make is whether to forward it or fail it based on the amount, previous hop, and next hop. When I refer to "reputation" hereafter, I do not mean a global reputation that is gossiped about -- just a local view of a peer's history.
For a Sybil-resistant reputation system, we can use money as a way of measuring reputation. Fees collected through routing payments across channels raise the reputation of the channel peer. You lose reputation by accepting an HTLC and not failing or fulfilling it quickly, proportional to the value of the HTLC and time to respond. What this essentially means is that if an attacker wants people to send them HTLCs to delay, they pay a certain amount in fees over time. So each node will track for each peer 1) total fees collected from forwarding on routes where that peer is the prior hop 2) total fees collect from forwarding on routes where that peer is the next hop 3) total value times time of money locked in offered HTLCs on channels to the peer. To track the third, as soon as an offered HTLC is locked in by the peer, the node starts a timer. When the HTLC is settled or failed or handled on-chain, the timer stops and the node registers the total elapsed time multiplied by the value of the HTLC.
A very simple strategy would be to have two factors, R_inbound and R_outbound and calculate reputation per peer as R_inbound * total inbound fees + R_outbound * total outbound fees - total Bitcoin-seconds locked in an HTLC. When forwarding a payment, you calculate the worst case reputation loss, HTLC value * (CLTV - current block height) * 10 min / block, and fail the payment if that value is greater than their current score. Effectively, reputation scores are the maximum number of Bitcoin-seconds on could waste in HTLCs as the downstream node in a channel. If you think, for example, having 1 BTC for 1 hour is worth 1 satoshi, you might set R_inbound = R_outbound = 10^8. Honest nodes should earn reputation passively by forwarding payments and failing/fulfilling quickly, while an attacker would lose reputation and have to pay fees to re-earn it. Furthermore, high reputation nodes should be able to earn reputation faster since peers will be willing to forward higher value HTLCs through them.
We want an additional property from this system though, which is that an attacker be limited in their ability to disrupt network connectivity and induce throttling on other channels. The above scheme has the problem that for every unit of reputation the attacker loses, each upstream hop also loses approximately the same amount -- they effectively get leverage on the ability to reduce reputation. So instead, consider a modification: each hop loses a quantity of reputation units equal to the *total* amount of Bitcoin-seconds lost upstream. So say there's a payment A -> B -> C -> D, where the CLTV decrements by 12 and the amount decrements by 10 satoshis at each hop, with a terminal CLTV of 12 and a terminal amount of 100. So A tells B "Here's an HTLC for 120 satoshis, CLTV is in 36 blocks, and you will lose reputation at a rate of 120 satoshi-seconds per second of delay". B calculates the maximum he could lose by forwarding to C as 120 * 36 blocks * 10 min / block. Assuming C has a high enough reputation score, B will offer an HTLC of 110 satoshis, CLTV of 24 blocks, reputation rate of 120 + 110 = 230 satoshi-seconds per second. And finally C requires D to stake reputation at a rate of 230 + 100 = 330 satoshi-seconds / second. The effect is that if any node withholds the preimage, they lose an amount of reputation equal to all of the reputation lost upstream combined, removing any attack leverage.
This strategy has some downsides, namely in terms of centralization and privacy. Telling the downstream node the rate at which they must stake reputation may allow them to determine the number of upstream hops in the circuit. To obfuscate this, the sender may require an addition reputation stake, but takes a higher risk of the payment failing somewhere downstream. The more obvious issue is centralization -- if payments are getting throttled by reputation, there is even more of an incentive to route through a small number of channels and decrease the length of payment circuits. While this is a concern, the degree to while throttling happens in controlled by the R parameters (the ratio at which fees contribute to reputation). If R is high and reputation is abundant, then there will be little throttling. But if a node finds itself under attack, it can raise its R parameters and start throttling bad peers.
In summary, I think a simple local reputation mechanism of this form could be implemented with only minor changes to the BOLT spec and could provide decent resistance against DOS/loop attacks. Sorry for the excessively long email.
[1] https://www.learnbitcoin.com/archive/lists/lightning-dev#m-2015-08 000135.html
Jim Posen <jim.posen at gmail.com> writes:
Quoted text (14 lines)
> There are two directions of solutions I have heard: 1) protocol support for > decrypting the onion route if the HTLC is kept in-flight for too long 2) > requiring fees even if the payment fails as a cost to the attacker 3) some > sort of reputation system for nodes. > > Option 1 I'm afraid may be quite complex. Say this mechanism kicks in and > all nodes in the circuit deobfuscate the route and are able to see the > delays at each hop. The outcome we hope for is that there is one node > clearly to blame and the prior hop in the route fails all channels with > them. However, the attacker can of course control multiple successive hops > in the route, one that looks innocent in front of one that looks guilty, > then keep the channel alive and try again. So then all nodes need to keep a > record of the full circuits and iteratively shift blame up the chain if bad > HTLCs keep going through those channels.
You missed the vital detail: that you must prove channel closure if you can't unpeel the onion further. That *will* hit an unresponsive party with a penalty.[1]
Quoted text (5 lines)
> Option 2 is also problematic because it only protects against the case > where the sender is colluding with the receiver, and not where a routing > node is opportunistically delaying payments. This would, however, likely be > successful against nodes being annoying and sending tons of payments with > randomly generated payment hashes in order to "ping" a circuit.
The models we tried in Milan all created an incentive to fail payments, which is a non-starter.
Quoted text (13 lines)
> Option 3 has become my preferred solution. The idea is that that for each > node that one has channels with, it only forwards payments through them if > they have a good history, otherwise it fails the payment. Notably, we > ignore whether the downstream hop is directly responsible for delaying a > payment or whether they are simply willing to forward to another node that > is intentionally delaying -- both should be considered bad behavior. In my > opinion, this type of solution fits best into the Lightning model of > independent, linked channels where each node has private contracts with its > direct peers. It also is the simplest in the context of onion routing > because if you are offered an HTLC to route, the only decision you can make > is whether to forward it or fail it based on the amount, previous hop, and > next hop. When I refer to "reputation" hereafter, I do not mean a global > reputation that is gossiped about -- just a local view of a peer's history.
This seems like we'd need some serious evaluation to show that this works, because the risks are very high.
I can destroy your node's reputation by routing crap through you; even if it costs me marginaly more reputation than it does you, that just means that the largest players can force failure upon smaller players, centralizing the network. And I think trying to ensure that it costs me more reputation than the sum of downstream reputation loss leaks too much information
If the system doesn't work perfectly, it creates incentive to de-anonymize payments so you can determine which are likely to fail, and also means nodes are safest not forwarding payments, lest they ruin their reputatation. But nodes which don't forward have much less privacy.
But I agree, all solutions I've seen to this problem are bad in different ways.
Cheers, Rusty.
[1] Proving that you've committed to a particular HTLC in a channel is
difficult, because of dust HTLCs[2] and partially-committed ones[3].
[2] We could have an OP_RETURN output which was a merkle tree of trimmed
HTLCs to cover the dust case.
[3] You committed to an HTLC but the peer didn't respond; you have no
proof. So you also need to present a merkle tree of uncommitted
HTLCs (limited, say, to 16) otherwise you can create 1M HTLCs, then
claim they were all in that one channel close.Good morning Rusty, Jim, and list,
Quoted text (7 lines)
> I can destroy your node's reputation by routing crap through you; even > > if it costs me marginaly more reputation than it does you, that just > > means that the largest players can force failure upon smaller players, > > centralizing the network.
My understanding of the proposal was that reputation loss would occur only if the reply (`update_htlc_fail` or `update_htlc_success`) is delayed; this means that for you to force me to lose reputation, you need to somehow make me delay my reply. In particular if you do simple things like give me an invalid onion, or make me forward to a payee who does not know the preimage, I do not lose reputation by replying very quickly with an `update_htlc_fail`.
Of course, a large player could force reputation loss by delaying reply when they receive, and having patsy nodes route to them. So for instance if it is Jim -> ZmnSCPxj -> Rusty, and Rusty activates the Blockstream-takes-over-the-world Apocalypse program, the Rusty node would then delay for a long time before replying, which makes my reputation suffer. But it also makes Rusty reputation suffer even more and my reaction would be that, the next time Jim hands me an HTLC that forwards to Rusty, I would instead quickly `update_htlc_fail` back to Jim (which does not lose me significant reputation due to my quick response) than risk forwarding it to you, since you have a reputation for being slow and unresponsive.
Indeed, another aspect of Jim proposal is that it is extremely local: if Jim has no channel to Rusty, then Jim has no opinion about Rusty, only about ZmnSCPxj. However, ZmnSCPxj does have an opinion about Rusty, as ZmnSCPxj has channel with Rusty. If I suffer too much reputation loss due to Rusty, my opinion of Rusty drops even faster, and I decide to `update_htlc_fail` in order to prevent Jim opinion of me from dropping too much that Jim decides not to forward to me (if I have other channels with more reasonable nodes).
But it also looks more and more like a policy of "just `update_htlc_fail`" keeps our reputation high: indeed never accepting a forwarding attempt would ensure reputation.
However, earning via fees should help provide incentive against "Just `update_htlc_fail`" always. If the goal is "how do I earn money fastest" then there is some optimal threshhold of risk-of-reputation-loss vs. fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" spectrum, but somewhere in between. We hope.
Quoted text (5 lines)
> And I think trying to ensure that it costs me > > more reputation than the sum of downstream reputation loss leaks too > > much information
Yes, this is a major drawback of the proposal. The rate at which the sender of the HTLC threatens me with reputation loss lets me estimate my distance from the ultimate sender of the funds.
Regards, ZmnSCPxj
Thanks for the thoughtful responses.
Quoted text (3 lines)
> You missed the vital detail: that you must prove channel closure if you > can't unpeel the onion further. That *will* hit an unresponsive party > with a penalty.
Ah, that is a good point. I still find the proposal overall worryingly complex in terms of communication overhead, time it takes to prove channel closure, all of your points in [1], [2], [3], etc. Furthermore, this mandates that immediate channel closure is the only allowed reaction to a party delaying an HTLC for a time period above a threshold -- the node reputation approach gives more discretion to the preceding hop. Deobfuscating the route may turn out to be the right option, but I think the reputation system has certain advantages over this.
Quoted text (2 lines)
> The models we tried in Milan all created an incentive to fail payments, > which is a non-starter.
Do you mind elaborating or summarizing the reasons? The way I'm analyzing it, even if there's a nominal spam fee paid to routing nodes that fail payments, as long as it's low enough (say 2-5% for arguments sake), the nodes still have more to gain by forwarding the payment and earning the full fee on a completed payment, and possibly the reputation boost associated with completing a payment if that system was in effect. Moreover, a node that constantly fails payments will be blacklisted by the sender eventually and stop receiving HTLCs from them at all. Overall, I don't think this is a profitable strategy. Furthermore, I think it works quite well in combination with the reputation system.
Quoted text (2 lines)
> This seems like we'd need some serious evaluation to show that this > works, because the risks are very high.
I agree that it needs to be evaluated. I may start working on some network simulations to test various DOS mitigation strategies.
Quoted text (6 lines)
> I can destroy your node's reputation by routing crap through you; even > if it costs me marginaly more reputation than it does you, that just > means that the largest players can force failure upon smaller players, > centralizing the network. And I think trying to ensure that it costs me > more reputation than the sum of downstream reputation loss leaks too > much information
I will add to ZmnSCPxj's response, which is mostly on point. The key here is that the only way to lose significant reputation is to delay a payment yourself or forward to a malicious downstream that delays -- neither of these can be forced by the sender alone. This amounts to a system where you are on the hook for any malicious behavior of your downstream peers, which is why you must keep a reputation score for each which they earn over time. This should keep all links in the network high quality and quickly disconnect off delaying nodes if the incentives are right.
While I agree that a lot of reputation is leaked by aggregating the losses along the route, this serves exactly to prevent large nodes with high reputation from ruining links elsewhere. There are two things a node looking to cause reputation loss could do. 1) Identify a node (not itself) it thinks will delay a payment and send to them. This locks up funds on their behalf, but is actually good behavior because it identifies a faulty node and rightfully forces a loss in their reputation, eventually resulting in them being booted from the network. Everyone upstream loses some reputation for having connectivity to them, but less because of the loss aggregation along the route. 2) Delay a payment oneself and force upstream reputation loss. This is why I think it's important that the reputation loss aggregate so that the malicious party loses the most.
As for the amount of information leaked, yes, it helps determine the number of upstream hops in a route. However, the CLTV values help determine the number of downstream hops in a route in exactly the same way. I see these as symmetric in a sense.
To address ZmnSCPxj's point:
Quoted text (8 lines)
> But it also looks more and more like a policy of "just `update_htlc_fail`" keeps our reputation high: indeed never accepting a forwarding attempt would ensure reputation. > However, earning via fees should help provide incentive against "Just `update_htlc_fail`" always. If the goal is "how do I earn money fastest" then there is some optimal threshhold > of risk-of-reputation-loss vs. fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" spectrum, but somewhere in between. We hope.
This is exactly the question that your local view of peer reputations helps solve: are the potential fees here worth the risk of forwarding this payment to this downstream? If their reputation is high, then you will want to forward because you think there's a low chance of you incurring reputation loss. If their reputation is low and the HTLC value is too high, you will fail it. So I disagree that "just `update_htlc_fail`" is an optimal strategy. Consider as well that all fees you earn on successful payments are profit to you as well as a reputation boost in the view of both of your peers. So in order to earn reputation, you have to forward payments. The key is not forwarding through malicious peers.
-jimpo
On Wed, May 9, 2018 at 12:31 AM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote:
Quoted text (62 lines)
> Good morning Rusty, Jim, and list, > > > I can destroy your node's reputation by routing crap through you; even > > > > if it costs me marginaly more reputation than it does you, that just > > > > means that the largest players can force failure upon smaller players, > > > > centralizing the network. > > My understanding of the proposal was that reputation loss would occur only > if the reply (`update_htlc_fail` or `update_htlc_success`) is delayed; this > means that for you to force me to lose reputation, you need to somehow make > me delay my reply. In particular if you do simple things like give me an > invalid onion, or make me forward to a payee who does not know the > preimage, I do not lose reputation by replying very quickly with an > `update_htlc_fail`. > > Of course, a large player could force reputation loss by delaying reply > when they receive, and having patsy nodes route to them. So for instance > if it is Jim -> ZmnSCPxj -> Rusty, and Rusty activates the > Blockstream-takes-over-the-world Apocalypse program, the Rusty node would > then delay for a long time before replying, which makes my reputation > suffer. But it also makes Rusty reputation suffer even more and my > reaction would be that, the next time Jim hands me an HTLC that forwards to > Rusty, I would instead quickly `update_htlc_fail` back to Jim (which does > not lose me significant reputation due to my quick response) than risk > forwarding it to you, since you have a reputation for being slow and > unresponsive. > > Indeed, another aspect of Jim proposal is that it is extremely local: if > Jim has no channel to Rusty, then Jim has no opinion about Rusty, only > about ZmnSCPxj. However, ZmnSCPxj does have an opinion about Rusty, as > ZmnSCPxj has channel with Rusty. If I suffer too much reputation loss due > to Rusty, my opinion of Rusty drops even faster, and I decide to > `update_htlc_fail` in order to prevent Jim opinion of me from dropping too > much that Jim decides not to forward to me (if I have other channels with > more reasonable nodes). > > But it also looks more and more like a policy of "just `update_htlc_fail`" > keeps our reputation high: indeed never accepting a forwarding attempt > would ensure reputation. > > However, earning via fees should help provide incentive against "Just > `update_htlc_fail`" always. If the goal is "how do I earn money fastest" > then there is some optimal threshhold of risk-of-reputation-loss vs. > fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" > spectrum, but somewhere in between. We hope. > > > And I think trying to ensure that it costs me > > > > more reputation than the sum of downstream reputation loss leaks too > > > > much information > > Yes, this is a major drawback of the proposal. The rate at which the > sender of the HTLC threatens me with reputation loss lets me estimate my > distance from the ultimate sender of the funds. > > Regards, > ZmnSCPxj >
One more point in terms of information leakage is that noise can be added to the "this is the rate that you'll lose reputation at" field to help obfuscate the number of upstream hops. I proposed setting it to "this is the upstream rate that I'm losing reputation at" + downstream HTLC value, but a node can decide to add noise. If they make it too low however, there's a risk of insufficiently punishing bad nodes and if they make it too high, there's a heightened risk that the payment fails because the downstream reputation is insufficient along the route.
This is why I say it's kind of symmetric to the CLTV value: if the delta is too low, there's risk of loss of funds, if the delta is too high, someone might decide to fail the payment instead of taking the delay risk.
On Wed, May 9, 2018 at 10:23 AM, Jim Posen <jim.posen at gmail.com> wrote:
Quoted text (159 lines)
> Thanks for the thoughtful responses. > > > You missed the vital detail: that you must prove channel closure if you > > can't unpeel the onion further. That *will* hit an unresponsive party > > with a penalty. > > Ah, that is a good point. I still find the proposal overall worryingly > complex in terms of communication overhead, time it takes to prove channel > closure, all of your points in [1], [2], [3], etc. Furthermore, this > mandates that immediate channel closure is the only allowed reaction to a > party delaying an HTLC for a time period above a threshold -- the node > reputation approach gives more discretion to the preceding hop. > Deobfuscating the route may turn out to be the right option, but I think > the reputation system has certain advantages over this. > > > The models we tried in Milan all created an incentive to fail payments, > > which is a non-starter. > > Do you mind elaborating or summarizing the reasons? The way I'm analyzing > it, even if there's a nominal spam fee paid to routing nodes that fail > payments, as long as it's low enough (say 2-5% for arguments sake), the > nodes still have more to gain by forwarding the payment and earning the > full fee on a completed payment, and possibly the reputation boost > associated with completing a payment if that system was in effect. > Moreover, a node that constantly fails payments will be blacklisted by the > sender eventually and stop receiving HTLCs from them at all. Overall, I > don't think this is a profitable strategy. Furthermore, I think it works > quite well in combination with the reputation system. > > > This seems like we'd need some serious evaluation to show that this > > works, because the risks are very high. > > I agree that it needs to be evaluated. I may start working on some network > simulations to test various DOS mitigation strategies. > > > I can destroy your node's reputation by routing crap through you; even > > if it costs me marginaly more reputation than it does you, that just > > means that the largest players can force failure upon smaller players, > > centralizing the network. And I think trying to ensure that it costs me > > more reputation than the sum of downstream reputation loss leaks too > > much information > > I will add to ZmnSCPxj's response, which is mostly on point. The key here > is that the only way to lose significant reputation is to delay a payment > yourself or forward to a malicious downstream that delays -- neither of > these can be forced by the sender alone. This amounts to a system where you > are on the hook for any malicious behavior of your downstream peers, which > is why you must keep a reputation score for each which they earn over time. > This should keep all links in the network high quality and quickly > disconnect off delaying nodes if the incentives are right. > > While I agree that a lot of reputation is leaked by aggregating the losses > along the route, this serves exactly to prevent large nodes with high > reputation from ruining links elsewhere. There are two things a node > looking to cause reputation loss could do. 1) Identify a node (not itself) > it thinks will delay a payment and send to them. This locks up funds on > their behalf, but is actually good behavior because it identifies a faulty > node and rightfully forces a loss in their reputation, eventually resulting > in them being booted from the network. Everyone upstream loses some > reputation for having connectivity to them, but less because of the loss > aggregation along the route. 2) Delay a payment oneself and force upstream > reputation loss. This is why I think it's important that the reputation > loss aggregate so that the malicious party loses the most. > > As for the amount of information leaked, yes, it helps determine the > number of upstream hops in a route. However, the CLTV values help determine > the number of downstream hops in a route in exactly the same way. I see > these as symmetric in a sense. > > To address ZmnSCPxj's point: > > > But it also looks more and more like a policy of "just > `update_htlc_fail`" keeps our reputation high: indeed never accepting a > forwarding attempt would ensure reputation. > > However, earning via fees should help provide incentive against "Just > `update_htlc_fail`" always. If the goal is "how do I earn money fastest" > then there is some optimal threshhold > of risk-of-reputation-loss vs. > fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" > spectrum, but somewhere in between. We hope. > > This is exactly the question that your local view of peer reputations > helps solve: are the potential fees here worth the risk of forwarding this > payment to this downstream? If their reputation is high, then you will want > to forward because you think there's a low chance of you incurring > reputation loss. If their reputation is low and the HTLC value is too high, > you will fail it. So I disagree that "just `update_htlc_fail`" is an > optimal strategy. Consider as well that all fees you earn on successful > payments are profit to you as well as a reputation boost in the view of > both of your peers. So in order to earn reputation, you have to forward > payments. The key is not forwarding through malicious peers. > > -jimpo > > On Wed, May 9, 2018 at 12:31 AM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote: > >> Good morning Rusty, Jim, and list, >> >> > I can destroy your node's reputation by routing crap through you; even >> > >> > if it costs me marginaly more reputation than it does you, that just >> > >> > means that the largest players can force failure upon smaller players, >> > >> > centralizing the network. >> >> My understanding of the proposal was that reputation loss would occur >> only if the reply (`update_htlc_fail` or `update_htlc_success`) is delayed; >> this means that for you to force me to lose reputation, you need to somehow >> make me delay my reply. In particular if you do simple things like give me >> an invalid onion, or make me forward to a payee who does not know the >> preimage, I do not lose reputation by replying very quickly with an >> `update_htlc_fail`. >> >> Of course, a large player could force reputation loss by delaying reply >> when they receive, and having patsy nodes route to them. So for instance >> if it is Jim -> ZmnSCPxj -> Rusty, and Rusty activates the >> Blockstream-takes-over-the-world Apocalypse program, the Rusty node >> would then delay for a long time before replying, which makes my reputation >> suffer. But it also makes Rusty reputation suffer even more and my >> reaction would be that, the next time Jim hands me an HTLC that forwards to >> Rusty, I would instead quickly `update_htlc_fail` back to Jim (which does >> not lose me significant reputation due to my quick response) than risk >> forwarding it to you, since you have a reputation for being slow and >> unresponsive. >> >> Indeed, another aspect of Jim proposal is that it is extremely local: if >> Jim has no channel to Rusty, then Jim has no opinion about Rusty, only >> about ZmnSCPxj. However, ZmnSCPxj does have an opinion about Rusty, as >> ZmnSCPxj has channel with Rusty. If I suffer too much reputation loss due >> to Rusty, my opinion of Rusty drops even faster, and I decide to >> `update_htlc_fail` in order to prevent Jim opinion of me from dropping too >> much that Jim decides not to forward to me (if I have other channels with >> more reasonable nodes). >> >> But it also looks more and more like a policy of "just >> `update_htlc_fail`" keeps our reputation high: indeed never accepting a >> forwarding attempt would ensure reputation. >> >> However, earning via fees should help provide incentive against "Just >> `update_htlc_fail`" always. If the goal is "how do I earn money fastest" >> then there is some optimal threshhold of risk-of-reputation-loss vs. >> fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" >> spectrum, but somewhere in between. We hope. >> >> > And I think trying to ensure that it costs me >> > >> > more reputation than the sum of downstream reputation loss leaks too >> > >> > much information >> >> Yes, this is a major drawback of the proposal. The rate at which the >> sender of the HTLC threatens me with reputation loss lets me estimate my >> distance from the ultimate sender of the funds. >> >> Regards, >> ZmnSCPxj >> > >
Good morning Jim,
Quoted text (1 line)
> One more point in terms of information leakage is that noise can be added to the "this is the rate that you'll lose reputation at" field to help obfuscate the number of upstream hops. I proposed setting it to "this is the upstream rate that I'm losing reputation at" + downstream HTLC value, but a node can decide to add noise. If they make it too low however, there's a risk of insufficiently punishing bad nodes and if they make it too high, there's a heightened risk that the payment fails because the downstream reputation is insufficient along the route.
I was about to propose this.
Indeed, I intend to implement CLTV-delay randomization for payments in C-lightning, i.e. "shadow routes", since that is a way to obfuscate the intermediate node distance from the payee. Randomizing the reputation-loss-rate is similar.
The concern however is that the CLTV already partly leaks the distance from the payee, whereas the reputation-loss-rate leaks distance from the payer. It is often not interesting to know that some entity is getting paid, but it probably far more interesting to know WHO paid WHO, so leaking both distances simultaneously is more than twice as worse as leaking just one distance.
Regards, ZmnSCPxj
Quoted text (72 lines)
> This is why I say it's kind of symmetric to the CLTV value: if the delta is too low, there's risk of loss of funds, if the delta is too high, someone might decide to fail the payment instead of taking the delay risk. > > On Wed, May 9, 2018 at 10:23 AM, Jim Posen <jim.posen at gmail.com> wrote: > >> Thanks for the thoughtful responses. >>> You missed the vital detail: that you must prove channel closure if you >>> can't unpeel the onion further. That *will* hit an unresponsive party >>> with a penalty. >> >> Ah, that is a good point. I still find the proposal overall worryingly complex in terms of communication overhead, time it takes to prove channel closure, all of your points in [1], [2], [3], etc. Furthermore, this mandates that immediate channel closure is the only allowed reaction to a party delaying an HTLC for a time period above a threshold -- the node reputation approach gives more discretion to the preceding hop. Deobfuscating the route may turn out to be the right option, but I think the reputation system has certain advantages over this. >>> The models we tried in Milan all created an incentive to fail payments, >>> which is a non-starter. >> >> Do you mind elaborating or summarizing the reasons? The way I'm analyzing it, even if there's a nominal spam fee paid to routing nodes that fail payments, as long as it's low enough (say 2-5% for arguments sake), the nodes still have more to gain by forwarding the payment and earning the full fee on a completed payment, and possibly the reputation boost associated with completing a payment if that system was in effect. Moreover, a node that constantly fails payments will be blacklisted by the sender eventually and stop receiving HTLCs from them at all. Overall, I don't think this is a profitable strategy. Furthermore, I think it works quite well in combination with the reputation system. >>> This seems like we'd need some serious evaluation to show that this >>> works, because the risks are very high. >> >> I agree that it needs to be evaluated. I may start working on some network simulations to test various DOS mitigation strategies. >> >>> I can destroy your node's reputation by routing crap through you; even >>> if it costs me marginaly more reputation than it does you, that just >>> means that the largest players can force failure upon smaller players, >>> centralizing the network. And I think trying to ensure that it costs me >>> more reputation than the sum of downstream reputation loss leaks too >>> much information >> >> I will add to ZmnSCPxj's response, which is mostly on point. The key here is that the only way to lose significant reputation is to delay a payment yourself or forward to a malicious downstream that delays -- neither of these can be forced by the sender alone. This amounts to a system where you are on the hook for any malicious behavior of your downstream peers, which is why you must keep a reputation score for each which they earn over time. This should keep all links in the network high quality and quickly disconnect off delaying nodes if the incentives are right. >> >> While I agree that a lot of reputation is leaked by aggregating the losses along the route, this serves exactly to prevent large nodes with high reputation from ruining links elsewhere. There are two things a node looking to cause reputation loss could do. 1) Identify a node (not itself) it thinks will delay a payment and send to them. This locks up funds on their behalf, but is actually good behavior because it identifies a faulty node and rightfully forces a loss in their reputation, eventually resulting in them being booted from the network. Everyone upstream loses some reputation for having connectivity to them, but less because of the loss aggregation along the route. 2) Delay a payment oneself and force upstream reputation loss. This is why I think it's important that the reputation loss aggregate so that the malicious party loses the most. >> >> As for the amount of information leaked, yes, it helps determine the number of upstream hops in a route. However, the CLTV values help determine the number of downstream hops in a route in exactly the same way. I see these as symmetric in a sense. >> >> To address ZmnSCPxj's point: >>> But it also looks more and more like a policy of "just `update_htlc_fail`" keeps our reputation high: indeed never accepting a forwarding attempt would ensure reputation. >>> However, earning via fees should help provide incentive against "Just `update_htlc_fail`" always. If the goal is "how do I earn money fastest" then there is some optimal threshhold > of risk-of-reputation-loss vs. fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" spectrum, but somewhere in between. We hope. >> >> This is exactly the question that your local view of peer reputations helps solve: are the potential fees here worth the risk of forwarding this payment to this downstream? If their reputation is high, then you will want to forward because you think there's a low chance of you incurring reputation loss. If their reputation is low and the HTLC value is too high, you will fail it. So I disagree that "just `update_htlc_fail`" is an optimal strategy. Consider as well that all fees you earn on successful payments are profit to you as well as a reputation boost in the view of both of your peers. So in order to earn reputation, you have to forward payments. The key is not forwarding through malicious peers. >> >> -jimpo >> >> On Wed, May 9, 2018 at 12:31 AM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote: >> >>> Good morning Rusty, Jim, and list, >>> >>>> I can destroy your node's reputation by routing crap through you; even >>>> >>>> if it costs me marginaly more reputation than it does you, that just >>>> >>>> means that the largest players can force failure upon smaller players, >>>> >>>> centralizing the network. >>> >>> My understanding of the proposal was that reputation loss would occur only if the reply (`update_htlc_fail` or `update_htlc_success`) is delayed; this means that for you to force me to lose reputation, you need to somehow make me delay my reply. In particular if you do simple things like give me an invalid onion, or make me forward to a payee who does not know the preimage, I do not lose reputation by replying very quickly with an `update_htlc_fail`. >>> >>> Of course, a large player could force reputation loss by delaying reply when they receive, and having patsy nodes route to them. So for instance if it is Jim -> ZmnSCPxj -> Rusty, and Rusty activates the Blockstream-takes-over-the-world Apocalypse program, the Rusty node would then delay for a long time before replying, which makes my reputation suffer. But it also makes Rusty reputation suffer even more and my reaction would be that, the next time Jim hands me an HTLC that forwards to Rusty, I would instead quickly `update_htlc_fail` back to Jim (which does not lose me significant reputation due to my quick response) than risk forwarding it to you, since you have a reputation for being slow and unresponsive. >>> >>> Indeed, another aspect of Jim proposal is that it is extremely local: if Jim has no channel to Rusty, then Jim has no opinion about Rusty, only about ZmnSCPxj. However, ZmnSCPxj does have an opinion about Rusty, as ZmnSCPxj has channel with Rusty. If I suffer too much reputation loss due to Rusty, my opinion of Rusty drops even faster, and I decide to `update_htlc_fail` in order to prevent Jim opinion of me from dropping too much that Jim decides not to forward to me (if I have other channels with more reasonable nodes). >>> >>> But it also looks more and more like a policy of "just `update_htlc_fail`" keeps our reputation high: indeed never accepting a forwarding attempt would ensure reputation. >>> >>> However, earning via fees should help provide incentive against "Just `update_htlc_fail`" always. If the goal is "how do I earn money fastest" then there is some optimal threshhold of risk-of-reputation-loss vs. fee-earnings-if-I-forward that is unlikely to be near the "Just fail it" spectrum, but somewhere in between. We hope. >>> >>>> And I think trying to ensure that it costs me >>>> >>>> more reputation than the sum of downstream reputation loss leaks too >>>> >>>> much information >>> >>> Yes, this is a major drawback of the proposal. The rate at which the sender of the HTLC threatens me with reputation loss lets me estimate my distance from the ultimate sender of the funds. >>> >>> Regards, >>> ZmnSCPxj
hello, I'm a curious lurker trying to follow this conversation:
On Thu, 10 May 2018, 2:40 pm ZmnSCPxj via Lightning-dev, < lightning-dev at lists.linuxfoundation.org> wrote:
Quoted text (8 lines)
> > The concern however is that the CLTV already partly leaks the distance > from the payee, whereas the reputation-loss-rate leaks distance from the > payer. It is often not interesting to know that some entity is getting > paid, but it probably far more interesting to know WHO paid WHO, so leaking > both distances simultaneously is more than twice as worse as leaking just > one distance. >
Consider an asymetrically-resourced malevolent node that wants the ability to harm a specific small nodes without aquiring a bad reputation (and is willing to pay for it). In preparation, this bad boss node directs normal traffic to sacrificial nodes they control, while understating the reputation-risk (truthfully as it turns out, because they have out of band influence over the node). When the time comes, the sacrificial node inflicts delay on the victim node and they both suffer, while the boss keeps her nose clean.
Is it the case that understating risk of legitimate traffic from boss node to sacrificial node effectively allows transfer of reputation to the sacrificial node in preparation for attack, while at the same time obscuring their association?
Chris Gough
Quoted text (1 line)
>
Hmm, I'm not quite following the situation. What do you mean by "directs normal traffic"? Since the sender constructs the entire circuit, routing nodes do not get any discretion over which nodes to forward a payment to, only whether to forward or fail. What an attacker could do is perform a loop attack and send a payment to another node that they control and delay the payment on the receiving end. Note that the sending node loses no reputation, only the receiving node. Since the hops being attacked are the ones in the middle and they are faithfully enforcing the reputation protocol, the receiving node's reputation should be penalized properly, making it unlikely the attack will succeed in a second attempt.
On Thu, May 10, 2018 at 2:56 PM, Chris Gough <christopher.d.gough at gmail.com> wrote:
Quoted text (37 lines)
> hello, I'm a curious lurker trying to follow this conversation: > > On Thu, 10 May 2018, 2:40 pm ZmnSCPxj via Lightning-dev, < > lightning-dev at lists.linuxfoundation.org> wrote: > >> >> The concern however is that the CLTV already partly leaks the distance >> from the payee, whereas the reputation-loss-rate leaks distance from the >> payer. It is often not interesting to know that some entity is getting >> paid, but it probably far more interesting to know WHO paid WHO, so leaking >> both distances simultaneously is more than twice as worse as leaking just >> one distance. >> > > Consider an asymetrically-resourced malevolent node that wants the ability > to harm a specific small nodes without aquiring a bad reputation (and is > willing to pay for it). In preparation, this bad boss node directs normal > traffic to sacrificial nodes they control, while understating the > reputation-risk (truthfully as it turns out, because they have out of band > influence over the node). When the time comes, the sacrificial node > inflicts delay on the victim node and they both suffer, while the boss > keeps her nose clean. > > Is it the case that understating risk of legitimate traffic from boss node > to sacrificial node effectively allows transfer of reputation to the > sacrificial node in preparation for attack, while at the same time > obscuring their association? > > Chris Gough > >> > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev > >
On Fri, May 11, 2018 at 9:18 AM, Jim Posen <jim.posen at gmail.com> wrote:
Quoted text (3 lines)
> Hmm, I'm not quite following the situation. What do you mean by "directs > normal traffic"? Since the sender constructs the entire circuit, routing > nodes do not get any discretion over which nodes to forward a payment to,
<facepalm>
Quoted text (7 lines)
> only whether to forward or fail. What an attacker could do is perform a loop > attack and send a payment to another node that they control and delay the > payment on the receiving end. Note that the sending node loses no > reputation, only the receiving node. Since the hops being attacked are the > ones in the middle and they are faithfully enforcing the reputation > protocol, the receiving node's reputation should be penalized properly, > making it unlikely the attack will succeed in a second attempt.
So the attacker can purchase reputation for the sacrificial node by sending them legitimate payments, and then spend that reputation (at the mutual expense of hops) by delaying targeted transactions. But my question about obscuring the collusion by artificially lowering reported risk was nonsense based on misunderstanding. Thanks for helping me understand.
Chris Gough
Jim Posen <jim.posen at gmail.com> writes:
Quoted text (14 lines)
> Thanks for the thoughtful responses. > >> You missed the vital detail: that you must prove channel closure if you >> can't unpeel the onion further. That *will* hit an unresponsive party >> with a penalty. > > Ah, that is a good point. I still find the proposal overall worryingly > complex in terms of communication overhead, time it takes to prove channel > closure, all of your points in [1], [2], [3], etc. Furthermore, this > mandates that immediate channel closure is the only allowed reaction to a > party delaying an HTLC for a time period above a threshold -- the node > reputation approach gives more discretion to the preceding hop. > Deobfuscating the route may turn out to be the right option, but I think > the reputation system has certain advantages over this.
Agreed, it's a tradeoff.
Quoted text (9 lines)
>> The models we tried in Milan all created an incentive to fail payments, >> which is a non-starter. > > Do you mind elaborating or summarizing the reasons? The way I'm analyzing > it, even if there's a nominal spam fee paid to routing nodes that fail > payments, as long as it's low enough (say 2-5% for arguments sake), the > nodes still have more to gain by forwarding the payment and earning the > full fee on a completed payment, and possibly the reputation boost > associated with completing a payment if that system was in effect.
You're forgetting the failure cases, where now I can profit.
If I disconnect from another node, I now have a disincentive to tell others. At the moment we send an update disabling the channel (though we should give a few seconds for reconnect first, but whatever).
Similarly, the rewards aren't proportional: being cheaper than other routes gets you all the traffic, but now you profit even if you can't service the payments. In fact, once a channel becomes hard to use (low capacity, transient disconnect, whatever), I *should* advertize it as cheaper route than anyone else: free money!
I'm sure there are other ways to game it, but the underlying reason is clear: it misaligns user and node incentives.
Quoted text (4 lines)
> Moreover, a node that constantly fails payments will be blacklisted by the > sender eventually and stop receiving HTLCs from them at all. Overall, I > don't think this is a profitable strategy. Furthermore, I think it works > quite well in combination with the reputation system.
If the system is sufficiently decentralized, managing to cheat everyone once is very profitable though.
Quoted text (21 lines)
>> This seems like we'd need some serious evaluation to show that this >> works, because the risks are very high. > > I agree that it needs to be evaluated. I may start working on some network > simulations to test various DOS mitigation strategies. > >> I can destroy your node's reputation by routing crap through you; even >> if it costs me marginaly more reputation than it does you, that just >> means that the largest players can force failure upon smaller players, >> centralizing the network. And I think trying to ensure that it costs me >> more reputation than the sum of downstream reputation loss leaks too >> much information > > I will add to ZmnSCPxj's response, which is mostly on point. The key here > is that the only way to lose significant reputation is to delay a payment > yourself or forward to a malicious downstream that delays -- neither of > these can be forced by the sender alone. This amounts to a system where you > are on the hook for any malicious behavior of your downstream peers, which > is why you must keep a reputation score for each which they earn over time. > This should keep all links in the network high quality and quickly > disconnect off delaying nodes if the incentives are right.
But I can make you look like a delaying node whenever I want. The only way to ensure that I lose more reputation than you do is to leak information about route length for *everyone*. And even then, it's just a matter of numbers. I can make successful payments to myself through the same peers (but not you!) to stay above their threshold so my reputation is intact.
So it's basically a question of how expensive is it for me to throw you off the network? You have to tune that number carefully.
Quoted text (12 lines)
> While I agree that a lot of reputation is leaked by aggregating the losses > along the route, this serves exactly to prevent large nodes with high > reputation from ruining links elsewhere. There are two things a node > looking to cause reputation loss could do. 1) Identify a node (not itself) > it thinks will delay a payment and send to them. This locks up funds on > their behalf, but is actually good behavior because it identifies a faulty > node and rightfully forces a loss in their reputation, eventually resulting > in them being booted from the network. Everyone upstream loses some > reputation for having connectivity to them, but less because of the loss > aggregation along the route. 2) Delay a payment oneself and force upstream > reputation loss. This is why I think it's important that the reputation > loss aggregate so that the malicious party loses the most.
But we're busy trying to remove all the methods of deanonymizing the network, and you seem to be adding a new one, *and* providing an incentive to deanonymize.
Quoted text (4 lines)
> As for the amount of information leaked, yes, it helps determine the number > of upstream hops in a route. However, the CLTV values help determine the > number of downstream hops in a route in exactly the same way. I see these > as symmetric in a sense.
Yes, which is why we have mitigations in place (which are still probably insufficient). I really don't want to add another vector.
Quoted text (3 lines)
> This is exactly the question that your local view of peer reputations helps > solve: are the potential fees here worth the risk of forwarding this > payment to this downstream?
So now I'll try to deanonymize all payments so I can determine this. Those who do this best will be rewarded, and those who don't try will be knocked off the network, probably by those who can!
So I'd like to see a real design of the reputation system. If it's practical (which is a significant hurdle), we then need to carefully evaluate whether we're creating significant disincentives to neighbourliness.
Cheers, Rusty.
Quoted text (18 lines)
> > You're forgetting the failure cases, where now I can profit. > > If I disconnect from another node, I now have a disincentive to tell > others. At the moment we send an update disabling the channel (though > we should give a few seconds for reconnect first, but whatever). > > Similarly, the rewards aren't proportional: being cheaper than other > routes gets you all the traffic, but now you profit even if you can't > service the payments. In fact, once a channel becomes hard to use (low > capacity, transient disconnect, whatever), I *should* advertize it as > cheaper route than anyone else: free money! > > I'm sure there are other ways to game it, but the underlying reason is > clear: it misaligns user and node incentives. If the system is sufficiently decentralized, managing to cheat everyone > once is very profitable though. >
I still don't agree with the conclusion.
What are the incentives currently for a node to advertise disabled channels? Firstly, it reduces computational effort of performing an unnecessary channel update. The main incentive though is that it is the recommended spec compliant behavior, and makes the link appear more reliable to the sender. I think this has to be analyzed as a repeated game, where senders will prefer links that not only advertise lower fees, but have a history of being reliable (or at least don't have a history of being unreliable). So with a fee of 0 on failed payments, we think that there's probably sufficient reason for nodes to advertise when channels are disabled. I'll grant, obviously, that if that there is high fee on failed payments that it would create incentive problems, but not if the unconditional fee is low enough. Note also the unconditional fee is also visible to senders, who will choose not to route through such links for this exact reason. So your example of a node advertising cheap fees on disabled links, it would only make sense to lower the success-conditional fee, not the unconditional fee. Ultimately, I think this will reach an equilibrium assuming senders have good route selection algorithms.
Now, that said, if this unconditional fee were the only (or even main) protection against loop attacks, it would probably require them to be so high as to create incentive problems. I am proposing the unconditional fee as a spam fee to punish senders who just send a bunch of failing payments in order to collect routing information, and put load on the network in the process for no good reason. With this as the purpose, I think this unconditional spam fee can be low enough to avoid the issues you raise.
One of my beliefs in structuring incentives it that it's far more acceptable for senders to get cheated by nodes they route through than for routers to be attacked. The reason is that senders collect a lot more information in failure cases and can avoid repeated occurrences by selecting routes differently. Routers, on the other hand, have far more limited information and choices and their operation is critical to the efficiency and decentralization of the system, so they should be protected by the protocol to a greater degree.
Quoted text (10 lines)
> But I can make you look like a delaying node whenever I want. The only > way to ensure that I lose more reputation than you do is to leak > information about route length for *everyone*. And even then, it's just > a matter of numbers. I can make successful payments to myself through > the same peers (but not you!) to stay above their threshold so my > reputation is intact. > > So it's basically a question of how expensive is it for me to throw you > off the network? You have to tune that number carefully. >
Remember, reputation is local to each node, so the only way you can raise your reputation with me is by participating in successful circuits *with me*. If you route successful payments on circuits with other peers, you may raise your reputation with them, but will do nothing to convince me to send more payments through you. So it is not true that you can make me look like a delaying node whenever you want; after a few bad interactions, I will stop routing through you until you participate in enough successful payments *with me* as the downstream to earn back your reputation.
I agree this number needs to be tuned carefully, but ideally this (the reputation rate loss) is something that can be tuned individually by routers according to their risk tolerance and history of attacks on the network. I think it's far preferable to have a number that can be tuned in the face of DoS attacks than being caught with no protection whatsoever.
Quoted text (7 lines)
But we're busy trying to remove all the methods of deanonymizing the > network, and you seem to be adding a new one, *and* providing an > incentive to deanonymize. > > Yes, which is why we have mitigations in place (which are still probably > insufficient). I really don't want to add another vector. >
This gets to the heart of the tradeoff between network efficiency and privacy. I admit that my proposal sacrifices on privacy, and I personally find it acceptable given the added protection against DoS attacks, but I understand the counterargument as well.
One additional thing to consider, though, is that if DoS attacks are problematic and there is no protection, many nodes may stop routing payments entirely. Onion routing through a network with very few possible circuits certainly is less private than revealing additional circuit information on a decentralized routing network.
Quoted text (4 lines)
> So now I'll try to deanonymize all payments so I can determine this. > Those who do this best will be rewarded, and those who don't try will be > knocked off the network, probably by those who can! >
I'm not following, how are you deanonymizing payments? Having more information about downstream hops can help one make better routing decisions, but if the reputation system works properly, you should only need to care about the reputation of the next hop.
Quoted text (5 lines)
> So I'd like to see a real design of the reputation system. If it's > practical (which is a significant hurdle), we then need to carefully > evaluate whether we're creating significant disincentives to > neighbourliness. >
I tried to mostly describe the design in the first email, but it's kind of disorganized. I'll try to sketch it out here more succinctly.
Each node has a local configuration of its "reputation loss rate" per channel in units of Hz. This configured rate is not explicitly advertised to peers. Each update_add_htlc has an additional field the "reputation loss rate" in units of satoshis per second, calculated as the reputation loss rate of the upstream HTLC plus the local reputation loss rate times the offered HTLC value. This value can be obfuscated somewhat by the origin of the payment and at each hop with some amount of noise, subject to the concerns raised in my discussion with ZmnSCPxj. When forwarding an HTLC, the upstream hop measures the elapsed time between delivery of a commitment signature on the add and receipt of the fail/update.
For each peer node, keep a reputation score in units of satoshis. For each peer, when a payment completes where they are the upstream or downstream hop, add the amount collected in fees to their reputation score. For each payment where they are the downstream hop, subtract from their reputation score the reputation loss rate on the offered HTLC times its elapsed time. Reputation score is not explicitly shared between peered nodes, but can be estimated to within differences in elapsed time measurements.
When you receive an HTLC to be forwarded to some downstream node, compare their current reputation score with the offered reputation loss rate times 10 minutes times the CLTV on the HTLC. If their reputation is sufficient, forward the HTLC and place a hold on their total reputation for that amount (so that concurrently forwarded HTLCs can't exceed their reputation "balance"). New, unknown, peers should get some initial reputation, presumably greater for channels that one initiates vs channels one receives.
Good morning,
Quoted text (13 lines)
>> But I can make you look like a delaying node whenever I want. The only >> way to ensure that I lose more reputation than you do is to leak >> information about route length for *everyone*. And even then, it's just >> a matter of numbers. I can make successful payments to myself through >> the same peers (but not you!) to stay above their threshold so my >> reputation is intact. >> >> So it's basically a question of how expensive is it for me to throw you >> off the network? You have to tune that number carefully. > > Remember, reputation is local to each node, so the only way you can raise your reputation with me is by participating in successful circuits *with me*. If you route successful payments on circuits with other peers, you may raise your reputation with them, but will do nothing to convince me to send more payments through you. So it is not true that you can make me look like a delaying node whenever you want; after a few bad interactions, I will stop routing through you until you participate in enough successful payments *with me* as the downstream to earn back your reputation. > > I agree this number needs to be tuned carefully, but ideally this (the reputation rate loss) is something that can be tuned individually by routers according to their risk tolerance and history of attacks on the network. I think it's far preferable to have a number that can be tuned in the face of DoS attacks than being caught with no protection whatsoever.
Consider the below network:
.Rusty1
. |
. v
.ZmnSCPxj->Jim
. | /
. v L
. Rusty2
Rusty1 can make me think highly of Rusty2, by routing many payments to Rusty2 which Rusty2 immediately accepts/forwards. Then Rusty1 can make me think lowly of Jim, by forwarding payments via Jim to Rusty2, and having Rusty2 delay the payment so that Jim loses reputation badly. Then in the future unrelated forwards that would have passed through ZmnSCPxj->Jim will be rejected by me because I think Jim has low reputation.
This holds even if local reputation is used.
Jim argues that this is unimportant, since (assuming all HTLC values are almost equal) Jim will stop forwarding to Rusty2 (due to imposing a higher "reputation loss rate" on Rusty2 than I impose in Jim) before I stop forwarding to Jim.
This can still be manipulated if Rusty1 opens a direct channel to Jim. Then Rusty1 can route payments Rusty1->Jim->Rusty2 that succeed quickly, then route payments Rusty1->ZmnSCPxj->Jim->Rusty2 that stall. Thus Rusty2 can have the Jim->Rusty2 reputation boosted, while alternating with reputation losses that make ZmnSCPxj->Jim reputation go down. Since local reputation is used, ZmnSCPxj and Jim will not talk to each other about how Rusty2 seems to stall when not routing a payment from Rusty1. Rusty1 can now manipulate the reputation view of ZmnSCPxj and Jim of each other while keeping Rusty2 reputation somewhat high.
Quoted text (16 lines)
>> But we're busy trying to remove all the methods of deanonymizing the >> network, and you seem to be adding a new one, *and* providing an >> incentive to deanonymize. >> >> Yes, which is why we have mitigations in place (which are still probably >> insufficient). I really don't want to add another vector. > > This gets to the heart of the tradeoff between network efficiency and privacy. I admit that my proposal sacrifices on privacy, and I personally find it acceptable given the added protection against DoS attacks, but I understand the counterargument as well. > > One additional thing to consider, though, is that if DoS attacks are problematic and there is no protection, many nodes may stop routing payments entirely. Onion routing through a network with very few possible circuits certainly is less private than revealing additional circuit information on a decentralized routing network. > >> So now I'll try to deanonymize all payments so I can determine this. >> Those who do this best will be rewarded, and those who don't try will be >> knocked off the network, probably by those who can! > > I'm not following, how are you deanonymizing payments? Having more information about downstream hops can help one make better routing decisions, but if the reputation system works properly, you should only need to care about the reputation of the next hop.
As mentioned, the CLTV total leaks information on how far the payee is. I might decide to keep track of a reputation score, not of the local peers I have, but on the entire network. If the CLTV total at my outgoing is high, then if the outgoing HTLC takes a long time to respond, I will distribute a small reputation loss to a large number of nodes that are accessible from the outgoing channel; if the CLTV total at my outgoing is low, I will distribute a large reputation loss to a small number of nodes that are accessible from the outgoing channel. I now have the incentive to make this estimation even more accurate in the future.
Quoted text (12 lines)
> > >> So I'd like to see a real design of the reputation system. If it's >> practical (which is a significant hurdle), we then need to carefully >> evaluate whether we're creating significant disincentives to >> neighbourliness. > > I tried to mostly describe the design in the first email, but it's kind of disorganized. I'll try to sketch it out here more succinctly. > > Each node has a local configuration of its "reputation loss rate" per channel in units of Hz. This configured rate is not explicitly advertised to peers. Each update_add_htlc has an additional field the "reputation loss rate" in units of satoshis per second, calculated as the reputation loss rate of the upstream HTLC plus the local reputation loss rate times the offered HTLC value. This value can be obfuscated somewhat by the origin of the payment and at each hop with some amount of noise, subject to the concerns raised in my discussion with ZmnSCPxj. When forwarding an HTLC, the upstream hop measures the elapsed time between delivery of a commitment signature on the add and receipt of the fail/update. > > For each peer node, keep a reputation score in units of satoshis. For each peer, when a payment completes where they are the upstream or downstream hop, add the amount collected in fees to their reputation score. For each payment where they are the downstream hop, subtract from their reputation score the reputation loss rate on the offered HTLC times its elapsed time. Reputation score is not explicitly shared between peered nodes, but can be estimated to within differences in elapsed time measurements.
Please describe the below:
1. Behavior if payment succeeds after T time. 2. Behavior if payment fails after T time.
It seems you only described "Behavior if payment succeeds after T time".
Regards, ZmnSCPxj
Quoted text (11 lines)
> > This can still be manipulated if Rusty1 opens a direct channel to Jim. > Then Rusty1 can route payments Rusty1->Jim->Rusty2 that succeed quickly, > then route payments Rusty1->ZmnSCPxj->Jim->Rusty2 that stall. Thus Rusty2 > can have the Jim->Rusty2 reputation boosted, while alternating with > reputation losses that make ZmnSCPxj->Jim reputation go down. Since local > reputation is used, ZmnSCPxj and Jim will not talk to each other about how > Rusty2 seems to stall when not routing a payment from Rusty1. Rusty1 can > now manipulate the reputation view of ZmnSCPxj and Jim of each other while > keeping Rusty2 reputation somewhat high. >
Yes, you are correct that in scenarios like this an attacker can pay to degrade the reputation of one of its peers (or even nodes further away). The key point is that doing so should be costly to the attacker because they must pay the victim node to continue making itself vulnerable to payment delays. But if the node is getting compensated, is that really an attack then? This system is designed with the assumption that the best way to defend an anonymous/decentralized network that allows sybils is by pricing resource utilization appropriately. In a similar way, the Bitcoin blockchain is "vulnerable" to spam attacks in the sense that attackers can pay to fill up block space.
Quoted text (10 lines)
> As mentioned, the CLTV total leaks information on how far the payee is. I > might decide to keep track of a reputation score, not of the local peers I > have, but on the entire network. If the CLTV total at my outgoing is high, > then if the outgoing HTLC takes a long time to respond, I will distribute a > small reputation loss to a large number of nodes that are accessible from > the outgoing channel; if the CLTV total at my outgoing is low, I will > distribute a large reputation loss to a small number of nodes that are > accessible from the outgoing channel. I now have the incentive to make > this estimation even more accurate in the future. >
One could do this today. I'd even argue that they are incentivized to already as a protection against loop attacks/payment delays. But it's likely a pretty ineffective strategy depending on the number of channels that the possible downstream hops have open.
Quoted text (7 lines)
Please describe the below: > > 1. Behavior if payment succeeds after T time. > 2. Behavior if payment fails after T time. > > It seems you only described "Behavior if payment succeeds after T time". >
Ah, sorry if I didn't make that clear. The reputation is increased in the case of successful payments by the fee collected. The reputation is decreased on the downstream peer proportional to time T *regardless* of whether the payment succeeds or fails. If a payment succeeds quickly, the increase should outweigh the decrease, but if the payment succeeds after a long time, the change in reputation may be net negative. If the payment fails, the upstream peer's reputation does not change and the downstream peer's reputation always decreases proportional to time T.
Good morning Jim,
Quoted text (3 lines)
>> This can still be manipulated if Rusty1 opens a direct channel to Jim. Then Rusty1 can route payments Rusty1->Jim->Rusty2 that succeed quickly, then route payments Rusty1->ZmnSCPxj->Jim->Rusty2 that stall. Thus Rusty2 can have the Jim->Rusty2 reputation boosted, while alternating with reputation losses that make ZmnSCPxj->Jim reputation go down. Since local reputation is used, ZmnSCPxj and Jim will not talk to each other about how Rusty2 seems to stall when not routing a payment from Rusty1. Rusty1 can now manipulate the reputation view of ZmnSCPxj and Jim of each other while keeping Rusty2 reputation somewhat high. > > Yes, you are correct that in scenarios like this an attacker can pay to degrade the reputation of one of its peers (or even nodes further away). The key point is that doing so should be costly to the attacker because they must pay the victim node to continue making itself vulnerable to payment delays. But if the node is getting compensated, is that really an attack then? This system is designed with the assumption that the best way to defend an anonymous/decentralized network that allows sybils is by pricing resource utilization appropriately. In a similar way, the Bitcoin blockchain is "vulnerable" to spam attacks in the sense that attackers can pay to fill up block space.
Hmm, you are indeed correct. Rusty brings up that a rich node can do this to victimize poorer nodes, though: even if the poorer node is compensated for the loss of reputation, the rich node may arrange the network such that it is the only one that can practically earn from forwarding fees, with everyone else suspicious of everyone except the rich node.
There may not be a way to solve this?
Quoted text (8 lines)
>> Please describe the below: >> >> 1. Behavior if payment succeeds after T time. >> 2. Behavior if payment fails after T time. >> >> It seems you only described "Behavior if payment succeeds after T time". > > Ah, sorry if I didn't make that clear. The reputation is increased in the case of successful payments by the fee collected. The reputation is decreased on the downstream peer proportional to time T regardless of whether the payment succeeds or fails. If a payment succeeds quickly, the increase should outweigh the decrease, but if the payment succeeds after a long time, the change in reputation may be net negative. If the payment fails, the upstream peer's reputation does not change and the downstream peer's reputation always decreases proportional to time T.
Thank you. So:
1. If payment succeeds after T time, upstream reputation is increased by fee earned, downstream reputation is increased by fee earned, downstream reputation is decreased by T * reputation_loss_rate. 2. If payment fails after T time, downstream reputation is decreased by T * reputation_loss_rate.
Regards, ZmnSCPxj
ZmnSCPxj <ZmnSCPxj at protonmail.com> writes:
Quoted text (13 lines)
>>> Please describe the below: >>> >>> 1. Behavior if payment succeeds after T time. >>> 2. Behavior if payment fails after T time. >>> >>> It seems you only described "Behavior if payment succeeds after T time". >> >> Ah, sorry if I didn't make that clear. The reputation is increased in the case of successful payments by the fee collected. The reputation is decreased on the downstream peer proportional to time T regardless of whether the payment succeeds or fails. If a payment succeeds quickly, the increase should outweigh the decrease, but if the payment succeeds after a long time, the change in reputation may be net negative. If the payment fails, the upstream peer's reputation does not change and the downstream peer's reputation always decreases proportional to time T. > > Thank you. So: > > 1. If payment succeeds after T time, upstream reputation is increased by fee earned, downstream reputation is increased by fee earned, downstream reputation is decreased by T * reputation_loss_rate. > 2. If payment fails after T time, downstream reputation is decreased by T * reputation_loss_rate.
So, to be clear, there's no *financial* fee on failure, just reputation fee?
Also, you talked about reputation_loss_rate as being a private per-node thing, and being an explicit thing in the HTLC. I'm ignoring the former, and assuming the latter.
OK, let's consider a 1000 satoshi HTLC, paying a 10ppm fee and with a 1ppm-per-second reputation_loss_rate.
If it succeeds in 1 second (measuring reputation in millisatoshi, because its cute):
reputation[source] += 10
reputation[destination] += 10 - 1
If it succeeds in 10 seconds:
reputation[source] += 10
reputation[destination] += 10 - 10
If it fails in 10 seconds:
reputation[destination] -= 10
And if it falls onto the chain and fails after 144 blocks:
reputation[destination] -= 86400
In this scheme, it seems that I can destroy N reputation points in 18 nodes for cost N:
Mallory1 -> Node1 -> Node2 -> ..... -> Node18 -> Mallory2
\
Mallory3
Mallory2 pays a crapload of fees to Node18 to pay Mallory3, getting a great reputation. Then Mallory1 sends a payment to Mallory2, which takes a day to resolve.
Of course, this is why you want ramped reputation_loss_rate, say 1ppm for Mallory1->Node1, 2ppm ->Node2.... 19ppm for Mallory2. That just means Mallory can destroy 9*N total reputation points, not 18*N.
You can fix this by making it reputation_loss_rate exponential, but I don't think Node1 could ever get the 262144x reputation to make the payment in the first place.
What am I missing?
Thanks, Rusty.
Good morning Rusty,
Quoted text (5 lines)
> Also, you talked about reputation_loss_rate as being a private per-node > > thing, and being an explicit thing in the HTLC. I'm ignoring the > > former, and assuming the latter.
Reputation (the score) is a private per-node thing, while the `reputation_loss_rate` is explicit in the HTLC.
I am uncertain how that changes your analysis, though. In a line network like you showed, the reputation "bins" are Node1->Node2 and Node2->Node1 and so on. It may be more useful to think of the reputation bins as assigned to half-chans than to nodes.
So the initial Mallory3->Node18->Mallory2 gives high reputation to half-chans Node18->Mallory3 and Node18->Mallory2, then sacrifices the Node18->Mallory3 reputation to destroy the NodeN -> NodeN+1 and NodeN+1->NodeN reputations.
Along that line, reputation lost is higher as N increases. Graphing reputation lost along that line, we form a triangle, and the area of the triangle is the total reputation destroyed. Only the length of one edge of the triangle is what is lost by the Node18->Mallory3 reputation score. So yes, it seems you are correct here.
Regards, ZmnSCPxj
Yes Rusty, you are correct that an attacker still gets leverage on their ability to destroy reputation unless the loss rates increase exponentially. And I agree that would be a very steep increase, serving do decrease circuit lengths dramatically. The reasoning for the linear increase in reputation loss comes from viewing reputation loss as compensation for time-value lost in locked HTLCs. In a sense, every node pays in reputation for all of the time-value locked in HTLCs upstream from them in proportion to the value assigned to it by the owners of the funds.
I'm not sure whether this would be an acceptable way of pricing payment delays, though I do think it is important to make attackers pay for the resources they are wasting on the network in some form.
On Fri, May 18, 2018 at 4:38 PM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote:
Quoted text (31 lines)
> Good morning Rusty, > > > > Also, you talked about reputation_loss_rate as being a private per-node > > > > thing, and being an explicit thing in the HTLC. I'm ignoring the > > > > former, and assuming the latter. > > Reputation (the score) is a private per-node thing, while the > `reputation_loss_rate` is explicit in the HTLC. > > I am uncertain how that changes your analysis, though. In a line network > like you showed, the reputation "bins" are Node1->Node2 and Node2->Node1 > and so on. It may be more useful to think of the reputation bins as > assigned to half-chans than to nodes. > > So the initial Mallory3->Node18->Mallory2 gives high reputation to > half-chans Node18->Mallory3 and Node18->Mallory2, then sacrifices the > Node18->Mallory3 reputation to destroy the NodeN -> NodeN+1 and > NodeN+1->NodeN reputations. > > Along that line, reputation lost is higher as N increases. Graphing > reputation lost along that line, we form a triangle, and the area of the > triangle is the total reputation destroyed. Only the length of one edge of > the triangle is what is lost by the Node18->Mallory3 reputation score. So > yes, it seems you are correct here. > > Regards, > ZmnSCPxj >
Quoted text (3 lines)
> You missed the vital detail: that you must prove channel closure if you > can't unpeel the onion further. That *will* hit an unresponsive party > with a penalty.[1]
Is this specified in a BOLT somewhere? I tried to find it several times, without success.
CJP
Good morning Corne,
I think onion unpeeling never made it into the BOLT spec precisely due to the problems with it. I think the unpeeling in question is essentially a hop node (rather than the ultimate payer/source) unpeeling the onion in order to find out who was being slow. Perhaps the discussion regarding it is archived elsewhere; I do not know myself.
Regards, ZmnSCPxj
Sent with ProtonMail Secure Email.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On May 22, 2018 11:47 PM, Corné Plooy via Lightning-dev <lightning-dev at lists.linuxfoundation.org> wrote:
Quoted text (17 lines)
> > You missed the vital detail: that you must prove channel closure if you > > > > can't unpeel the onion further. That will hit an unresponsive party > > > > with a penalty.[1] > > Is this specified in a BOLT somewhere? I tried to find it several times, > > without success. > > CJP > > Lightning-dev mailing list > > Lightning-dev at lists.linuxfoundation.org > > https://www.learnbitcoin.com/archive/lists/lightning-dev
Only place I see the onion peeling discussed is here: https://github.com/lightningnetwork/lightning-rfc/issues/182.
On Tue, May 22, 2018 at 3:50 PM, ZmnSCPxj via Lightning-dev < lightning-dev at lists.linuxfoundation.org> wrote:
Quoted text (42 lines)
> Good morning Corne, > > I think onion unpeeling never made it into the BOLT spec precisely due to > the problems with it. I think the unpeeling in question is essentially a > hop node (rather than the ultimate payer/source) unpeeling the onion in > order to find out who was being slow. Perhaps the discussion regarding it > is archived elsewhere; I do not know myself. > > Regards, > ZmnSCPxj > > Sent with ProtonMail Secure Email. > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > > On May 22, 2018 11:47 PM, Corné Plooy via Lightning-dev < > lightning-dev at lists.linuxfoundation.org> wrote: > > > > You missed the vital detail: that you must prove channel closure if you > > > > > > can't unpeel the onion further. That will hit an unresponsive party > > > > > > with a penalty.[1] > > > > Is this specified in a BOLT somewhere? I tried to find it several times, > > > > without success. > > > > CJP > > > > Lightning-dev mailing list > > > > Lightning-dev at lists.linuxfoundation.org > > > > https://www.learnbitcoin.com/archive/lists/lightning-dev > > > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >