Skip to content

Conversation

@t-bast
Copy link
Collaborator

@t-bast t-bast commented Sep 13, 2019

It is currently very easy for a forwarding node to discover if the next node is the recipient.
Imagine for example that we use the following route:

Alice -> Bob -> Carol -> Dave

When Carol receives the HTLC from Bob, instead of normally forwarding the onion, she can instead
create a new one-hop payment to Dave with the payment hash, amount and cltv that she would have
forwarded.

If Dave fulfills the HTLC, then he was the recipient and Carol can forward the HTLC fulfill,
completing the payment normally.
If Dave returns an error, he isn't the recipient and Carol resumes the normal payment flow by
sending him the peeled onion received from Bob.

This is a very cheap de-anonymization attack. Fortunately, it is also quite easy to fix by adding
a payment secret in the invoice that the payer needs to include in the last hop payload.

For backwards-compatibility with legacy payers, we use feature bits in the invoice to allow payees
to generate both invoices that require this payment_secret and invoices that don't (but hopefully
in a few releases we can make all implementations set this bit to mandatory by default).

It is currently very easy for a forwarding node to discover if the next node is the recipient.
Imagine for example that we use the following route:

```
Alice -> Bob -> Carol -> Dave
```

When Carol receives the HTLC from Bob, instead of normally forwarding the onion, she can instead
create a new one-hop payment to Dave with the payment hash, amount and cltv that she would have
forwarded.

If Dave fulfills the HTLC, then he was the recipient and Carol can forward the HTLC fulfill,
completing the payment normally.
If Dave returns an error, he isn't the recipient and Carol resumes the normal payment flow by
sending him the peeled onion received from Bob.

This is a very cheap de-anonymization attack. Fortunately, it is also quite easy to fix by adding
a payment secret in the invoice that the payer needs to include in the last hop payload.

For backwards-compatibility with legacy payers, we use feature bits in the invoice to allow payees
to generate both invoices that require this payment_secret and invoices that don't (but hopefully
in a few releases we can make all implementations set this bit to mandatory by default).
2. types:
1. type: 1 (`payment_secret`)
2. data:
* [`u16`:`payment_secret`]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a 16 bit field! You mean 16*bytes I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops definitely, thanks for spotting this

@t-bast
Copy link
Collaborator Author

t-bast commented Sep 16, 2019

@cfromknecht this should also cover the attack on 0-amount invoices (for both normal invoices and AMP). Let me know what you think.

@t-bast t-bast added the Meeting Discussion Raise at next meeting label Sep 16, 2019
@t-bast t-bast mentioned this pull request Sep 17, 2019
`payment_hash` is incorrect or the CLTV expiry of the htlc is too close to the
current block height for safe handling.
The `payment_hash` is unknown to the final node, the `payment_secret` doesn't
match the `payment_hash`, the amount for that `payment_hash` is incorrect or
Copy link
Collaborator

@niftynei niftynei Oct 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kind of confusing: "the payment_secret doesn't match the payment_hash"

I think what you really mean to convey is that the payment_secret corresponds with the expected secret for that payment_hash.

'match' implies equivalence, which isn't the exact case here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the wording isn't great. This PR is now included in the MPP once so I'll be closing it anyway ;)

@t-bast
Copy link
Collaborator Author

t-bast commented Nov 8, 2019

This has been included in #643 and evolution is being done over there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Meeting Discussion Raise at next meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants