Skip to content

fix(kad-dht): bind signed PeerRecord to its signer identity#1348

Open
yashksaini-coder wants to merge 1 commit into
libp2p:mainfrom
yashksaini-coder:fix/1338-kaddht-signer-identity-binding
Open

fix(kad-dht): bind signed PeerRecord to its signer identity#1348
yashksaini-coder wants to merge 1 commit into
libp2p:mainfrom
yashksaini-coder:fix/1338-kaddht-signer-identity-binding

Conversation

@yashksaini-coder

Copy link
Copy Markdown
Contributor

Fixes #1338.

maybe_consume_signed_record accepted a signed PeerRecord whenever the claimed peer_id matched, without checking 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 (certified-address-book poisoning).

It now rejects any record where ID.from_pubkey(envelope.public_key) != 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. Full tests/core/kad_dht suite passes.

)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KadDHT accepts signed PeerRecords with mismatched signer identity

1 participant