- Severity: HIGH
- CVE: CVE-2026-110789
- Ecosystems: npm
- Packages: @libp2p/crypto
### Summary
A remote peer can stall a js-libp2p node’s entire event loop for ~4–5 seconds per connection (and transiently allocate ~2 GB) by sending a ~15-byte crafted `publicKey` inside an Identify message. The malformed key reaches the DER decoder before any peer-id/signature check, so the attack is pre-auth and repeatable indefinitely by reconnecting.
### Details
`packages/crypto/src/keys/rsa/der.ts` `readLength()` parses DER long-form lengths with no comparison to `buf.byteLength`, and `readInteger()` then loops over the attacker-claimed length:
“`ts
function readInteger (buf, context) {
const length = readLength(buf, context) // attacker-controlled, claims up to 2^64
const end = context.offset + length
for (let i = context.offset; i < end; i++) // runs far past buf.byteLength
vals.push(buf[i]) // pushes `undefined` past the end
}
“`
The blob reaches the parser pre-auth: Identify runs on every `connection:open` and calls `publicKeyFromProtobuf(publicKey)` (`packages/protocol-identify/src/identify.ts:85`) before the `connection.remotePeer.equals(id)` check at `identify.ts:88`. The `MAX_RSA_JWK_SIZE` guard in `pkixToRSAPublicKey` only bounds the total blob size, not the inner length field, so a 15-byte payload defeats it; the ECDSA path (`unmarshalECDSAPublicKey`) has no cap at all. The decode runs in a single synchronous tick, so no `AbortSignal` — including Identify’s 5 s timeout — can interrupt it. Verified on js-libp2p commit `a04f5e0`, where `@libp2p/crypto` r…
Source: GitHub Security Advisories · 2026-11-17