# GHSA-wc36-xgcc-jwpr: Failure to verify the public key of a `SignedEnvelope` against the `PeerId` in a `PeerRecord`

> Attackers can spoof peer identities by republishing records with mismatched keys, bypassing identity verification in libp2p networks.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 7 Feb 2022
- **Also known as:** RUSTSEC-2022-0009

## What is GHSA-wc36-xgcc-jwpr?

GHSA-wc36-xgcc-jwpr is a vulnerability in libp2p-core, published on 7 Feb 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Affected versions of this crate did not check that the public key the signature was created with matches the peer ID of the peer record. 
Any combination was considered valid.

This allows an attacker to republish an existing `PeerRecord` with a different `PeerId`.

## Which versions are affected by GHSA-wc36-xgcc-jwpr?

3 open source packages ship an affected version, including libp2p-core.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libp2p-core` | crates.io | From 0.30.0-rc.1 | 0.30.2, 0.31.1 |
| `libp2p-core` | crates.io | From 0.30.0-rc.1 | 0.30.2 |
| `libp2p-core` | crates.io | From 0.30.0-rc.1 | 0.30.2 |

## How do I fix GHSA-wc36-xgcc-jwpr?

Upgrade libp2p-core to a fixed version for your release line: 0.30.2 or 0.31.1.

## Is GHSA-wc36-xgcc-jwpr being exploited?

There is no known exploitation of GHSA-wc36-xgcc-jwpr in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-wc36-xgcc-jwpr and fix it if it is affected.

What it is: GHSA-wc36-xgcc-jwpr is a vulnerability in libp2p-core, published on 7 Feb 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-wc36-xgcc-jwpr in the wild and no public exploit code.

Affected packages and fixed versions:
- libp2p-core (crates.io): affected from 0.30.0-rc.1; fixed in 0.30.2, 0.31.1
- libp2p-core (crates.io): affected from 0.30.0-rc.1; fixed in 0.30.2
- libp2p-core (crates.io): affected from 0.30.0-rc.1; fixed in 0.30.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-wc36-xgcc-jwpr/ (Markdown: https://insights.sbomify.com/GHSA-wc36-xgcc-jwpr/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-wc36-xgcc-jwpr

---
From sbomify Insights: https://insights.sbomify.com/GHSA-wc36-xgcc-jwpr/
Summaries are generated and may contain mistakes; the official description above is the record.
