-
Notifications
You must be signed in to change notification settings - Fork 118
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(net): Avoid some self-connection nonce removal attacks #6410
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6410 +/- ##
==========================================
- Coverage 77.72% 77.71% -0.01%
==========================================
Files 307 307
Lines 40282 40283 +1
==========================================
- Hits 31310 31307 -3
- Misses 8972 8976 +4 |
36 tasks
2674480
to
c887a21
Compare
ba4e144
to
7da974d
Compare
oxarbitrage
previously approved these changes
Apr 22, 2023
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.
Looks good to me, i made a few optional documentation suggestions.
7307c98
to
2325311
Compare
oxarbitrage
approved these changes
Apr 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-concurrency
Area: Async code, needs extra work to make it work properly.
A-network
Area: Network protocol updates or fixes
C-audit
Category: Issues arising from audit findings
C-bug
Category: This is a bug
I-invalid-data
Zebra relies on invalid or untrusted data, or sends invalid data
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
We want Zebra to continue to reject self-connections, even if a malicious peer replays one of our nonces.
Fixes #6339
Complex Code or Requirements
This code changes concurrent futures with futures-based mutex locking.
The amount of work done in the critical sections is small.
Solution
Manual Testing
I ran:
And got these logs:
This shows that both sides of a self-connection reject that connection with a nonce reuse error.
Review
This is a routine audit fix.
Reviewer Checklist
Follow Up
Add more unit tests:
These tests are complicated, so I don't think they are worth the effort to do now.