-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] channel announcement signatures must cover the tlv stream #9000
Comments
I could reproduce this, |
How can both channel parties agree on the tlv data to sign? |
It depends on the spec for each specific TLV field (I don't know what this |
LND sees the node ann as valid, not sure why the discrepancy. As far as the TLV fields, I agree that they should be negotiated in announce sig, but it's not spelled out in the spec afaict which is why prob why we dont do it. |
|
Bolt 7 explicitly says that to produce the signatures, you "MUST compute the double-SHA256 hash h of the message, beginning at offset 256, up to the end of the message.". It thus requires signing the TLVs since they are part of the message bytes, do you think we should modify the spec to make this clearer?
Interesting, so for that node announcement, eclair sees it as invalid and lnd sees it as valid. Do we both encode it to the same value (
I don't understand, that bLIP mentions setting this TLV in |
Both parties should sign the same data, right? If so, I think the spec needs to be explicit about how both parties can agree on the TLV data to sign; I don't think that's spelled out anywhere. On second thought, it can't be in announcement sigs because that's where we actually put the sig, so it needs to be prior to that. |
It's not spelled out anywhere yet because there is no TLV defined yet for We can add a sentence to the BOLTs to spell this out, and defer this negotiation to every feature that needs it. I still don't understand why you chose to include a TLV in |
Do you have a fully encoded version? Starting with |
It is a fully encoded version, |
LDK says |
Thanks for checking! This
|
Perhaps someone else implemented it, but incorrectly? AFAIK, the field is only in the We also do include the extra TLV data in what we sign: lnd/lnwire/channel_announcement.go Lines 181 to 183 in c0420fe
Here's where we make our channel announcement, we add no extra TLVs: Lines 4149 to 4156 in c0420fe
Could it be that new impl that has popped up maybe? |
Damn, it's probably someone who forked lnd, I think it's the only implementation with inbound fees support...the issue is that lnd does relay those invalid |
Weird that we relay them, given we use that same We'll try more repro attempts.... |
Oops, I forgot to actually validate the node announcement. LND sees it as invalid |
Ok, we might've found something here: Line 2235 in c0420fe
|
Fix is up here: #9002 TL;DR is that I introduced a bug here 6 years ago, but it went unnoticed as we didn't use TLVs in any gossip stuff yet. The fix itself is 1 line. Once nodes update, they'll start to send the correct chan ann either once they issue a fee/policy update, or once the node rebroadcasts channels that are close to being considered zombies. |
Nice, thanks for the quick investigation! |
I just hacked some more logging into my CLN node, and seems like we have a bug:
Will add testing and fix now, thanks! |
AFAIU you're right - this message is not validly signed so you should be failing. |
Ah, right, I read too fast. Indeed... |
Yeah the bug was updating the TLV in the chan ann, but not re-signing before we sent it out (to actually cover those fields). |
I've been noticing that our node receives a lot of gossip data that has invalid signatures.
This happens for node announcements, channel announcements and channel updates.
I've been able to track the reason behind the channel announcement issue: those channel announcements contain a TLV field (with tag 55555) and the signature doesn't cover that TLV field (it should!). Here is one example from mainnet:
The signatures in this channel announcement don't cover the full channel announcement, as they don't sign the TLV stream. If you remove the TLV stream data, then the signatures are valid.
For node announcements, I'm not sure what the issue is. The following node announcement for example was relayed to our node and has an invalid signature:
I'd like to know if lnd agrees that the signature is incorrect: if that's the case, why is lnd still relaying that invalid node announcement?
The text was updated successfully, but these errors were encountered: