-
Notifications
You must be signed in to change notification settings - Fork 339
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
fix: warn on mismatched underlay #2464
Conversation
7198e9f
to
2c27287
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just good to amend the PR title
2c27287
to
f981aa2
Compare
f981aa2
to
12e81a3
Compare
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
|
||
if s.libp2pID != observedUnderlayAddrInfo.ID { | ||
//NOTE eventually we will return error here, but for now we want to gather some statistics | ||
s.logger.Warningf("received peer ID %s does not match ours: %s", observedUnderlayAddrInfo.ID, s.libp2pID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@acud normally we should return error here but we thought about maybe leaving it as a warning to gather some statistics about how often it happens.
Do you think this kind of data would be valuable or should we error here right away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @acud and @janos)
pkg/p2p/libp2p/internal/handshake/handshake.go, line 160 at r2 (raw file):
Previously, notanatol (Anatol) wrote…
@acud normally we should return error here but we thought about maybe leaving it as a warning to gather some statistics about how often it happens.
Do you think this kind of data would be valuable or should we error here right away?
I think you can return an error after the logline!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @acud and @janos)
pkg/p2p/libp2p/internal/handshake/handshake.go, line 160 at r2 (raw file):
Previously, mrekucci wrote…
I think you can return an error after the logline!?
Yes, technically it's doable, but it's just a general concern when it comes to introducing such a change to the behavior of the handshake protocol.
We are not sure how often this condition would be met "in the wild" where some peers might be behind NAT and the underlays might not match.
|
||
if s.libp2pID != observedUnderlayAddrInfo.ID { | ||
//NOTE eventually we will return error here, but for now we want to gather some statistics | ||
s.logger.Warningf("received peer ID %s does not match ours: %s", observedUnderlayAddrInfo.ID, s.libp2pID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
SWA-01-008 WP2: Injection of corrupted underlay into P2P handshake (Medium)
While auditing libp2p and the handshake protocol, it was observed that the underlay address is retrieved from the unsigned part of the
SynAck
structure (second packet within the handshake), thereby being unprotected.An attacker could leverage this and modify that part of the message without the client noticing during the initial handshake, which would result in corrupting the underlay network information provided to the client.
This change is