libp2p / libp2p/cpp-libp2p

Lack of signedPeerRecord Validation in C++ IdentifyMessageProcessor Leads to Address Injection

Open
#332 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
492
Forks
130
PR merge metrics
No merged PRs in 30d

Description

Summary

The C++ implementation of libp2p’s Identify protocol (IdentifyMessageProcessor) does not validate or process the signedPeerRecord field in Identify messages.
This allows malicious peers to inject or forward third-party signed peer records, leading to address poisoning and potential identity spoofing, similar to previously fixed vulnerabilities in Go and JS libp2p implementations.

Expected behavior

When an Identify message includes a signedPeerRecord:

The envelope signature must be verified.

The public key inside the envelope must derive a PeerId equal to the connection’s remotePeerId.

The PeerRecord.peerId must also match this derived PeerId.

Only if all checks succeed should the certified addresses be accepted and stored.

Actual behavior

The current C++ code (IdentifyMessageProcessor::identifyReceived) only verifies the publicKey field.

It does not parse or validate signedPeerRecord.

A malicious peer can forward another peer’s valid signed record, causing addresses of an unrelated peer to be stored.

Relevant log output

Possible Solution

Go libp2p issue: Identity protocol accepts signed peer records without validation
Go libp2p fix: x
The revelent_file

Version

No response

Would you like to work on fixing this bug ?

Yes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/protocol/identify/identify_msg_processor.cpp, especially IdentifyMessageProcessor::identifyReceived, and compare the referenced Go libp2p fix for validation behavior. Done means signedPeerRecord envelopes are verified, both PeerId relationships are checked against the connection and record, and certified addresses are accepted only when all checks succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.