Libp2p js-libp2p
libp2p: ASN.1 DER decoder drives an unbounded synchronous loop on attacker-controlled length fields, stalling the Node event loop pre-auth
libp2p is a JavaScript implementation of the libp2p networking stack. Prior to 5.1.22, the @libp2p/crypto code reached by the default Identify service accepts a remote peer’s crafted publicKey before peer-id or signature verification and passes it through publicKeyFromProtobuf to the ASN.1 DER decoder. readLength in packages/crypto/src/keys/rsa/der.ts accepts long-form element lengths larger than the remaining buffer, causing readInteger and related readers to loop synchronously over an attacker-claimed length from a very small key blob. Because decoding occurs in one event-loop tick before the remotePeer equality check in packages/protocol-identify/src/identify.ts, the Identify timeout cannot interrupt it, allowing repeated unauthenticated connections to stall all timers and peers and transiently exhaust memory. This issue is fixed in version 5.1.22.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- < 3.3.8
Fixed in 3.3.8
- < 5.1.22
Fixed in 5.1.22
Mitigation
Upgrade js-libp2p to 3.3.8 or later.
Upgrade crypto to 5.1.22 or later.
References
- Vendor advisory github.com/libp2p/js-libp2p/security/advisorie…
- Patch github.com/libp2p/js-libp2p/pull/3587
- Patch github.com/libp2p/js-libp2p/commit/ef6e1851cb0…
1 more
- Release notes github.com/libp2p/js-libp2p/releases/tag/crypt…
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.