Skip to content
High 7.5

libp2pに認証前の細工された公開鍵で処理を止められる脆弱性

CVE-2026-110789 First seen on SecPulse

Summary

libp2pのJavaScript実装では、細工された公開鍵をASN.1 DERデコーダーが処理する際に無制限の同期ループが発生し、Nodeのイベントループが止まるおそれがあります。認証前の接続だけで、タイマーや他のピアの処理が停止し、メモリが一時的に枯渇するおそれがあります。5.1.22で修正されているため、js-libp2pとcryptoを5.1.22以降に更新してください。

AI summary

Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.

libp2pのJavaScript実装では、細工された公開鍵をASN.1 DERデコーダーが処理する際に無制限の同期ループが発生し、Nodeのイベントループが止まるおそれがあります。認証前の接続だけで、タイマーや他のピアの処理が停止し、メモリが一時的に枯渇するおそれがあります。5.1.22で修正されているため、js-libp2pとcryptoを5.1.22以降に更新してください。

Affected packages

PackageAffected → Fixed
libp2pjs-libp2p —
@libp2pcrypto —
npm@libp2p/crypto
< 5.1.22→ 5.1.22
Original description The description as published by the source.

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:

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 `a0…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details