fix(kad-dht): bind signed PeerRecord to its signer identity#1348
Open
yashksaini-coder wants to merge 1 commit into
Open
fix(kad-dht): bind signed PeerRecord to its signer identity#1348yashksaini-coder wants to merge 1 commit into
yashksaini-coder wants to merge 1 commit into
Conversation
) maybe_consume_signed_record validated only that the record's claimed peer_id matched the expected/sender id, never that the envelope's signer key derived to that peer_id. A valid signature from an unrelated key could therefore certify attacker-controlled addresses for an arbitrary victim peer id, poisoning the certified address book. Reject any signed record where ID.from_pubkey(envelope.public_key) does not equal record.peer_id, on both the senderRecord and signedRecord paths. Adds tests/core/kad_dht/test_signed_record_signer_binding.py covering the forged-record rejection (both paths) and the self-signed acceptance path.
3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1338.
maybe_consume_signed_recordaccepted a signedPeerRecordwhenever the claimedpeer_idmatched, without checking that the envelope's signer key derived to thatpeer_id. A valid signature from an unrelated key could therefore certify attacker-controlled addresses for an arbitrary victim peer ID (certified-address-book poisoning).It now rejects any record where
ID.from_pubkey(envelope.public_key) != record.peer_id, on both thesenderRecordandsignedRecordpaths.Adds
tests/core/kad_dht/test_signed_record_signer_binding.pycovering the forged-record rejection (both paths) and the self-signed acceptance path. Fulltests/core/kad_dhtsuite passes.