libp2p-gossipsub Remote Denial of Service via Integer Overflow
A remote, unauthenticated attacker can crash applications using libp2p-gossipsub versions prior to 0.49.4 by sending a crafted PRUNE control message with a near-maximum backoff value, causing an arithmetic overflow during heartbeat processing.
The Rust libp2p Gossipsub implementation, a peer-to-peer networking library, is susceptible to a remote denial-of-service (DoS) vulnerability. This flaw resides in the handling of backoff expiry during heartbeat processing. By sending a specially crafted PRUNE control message containing an attacker-controlled, near-maximum backoff value, a remote, unauthenticated peer can trigger an integer overflow. This overflow occurs when the implementation performs unchecked addition of the backoff_time and a slack value. This vulnerability affects applications using libp2p-gossipsub versions prior to 0.49.4 and is distinct from CVE-2026-33040, which addressed overflow during backoff insertion. This report highlights a distinct secondary overflow path in heartbeat expiry handling that remained exploitable even after the initial insertion-side hardening. The vulnerability was reported by the Security team of the Ethereum Foundation.
Attack Chain
- An attacker establishes a standard libp2p session with a target node using
TCP + Noisefor encryption. - The attacker negotiates a stream multiplexer protocol such as
mplexoryamux. - The attacker opens a Gossipsub stream with the target node to initiate communication.
- The attacker sends an RPC (Remote Procedure Call) containing a
ControlPrunemessage. - The
ControlPrunemessage includes a craftedbackoffvalue set near the maximum representable value for an i64 integer (e.g.,9223372036854674580). The attacker chooses this value relative to the victim’s uptime. - The target node parses the
backoffvalue from the protobuf message and processes it usingBehaviour::handle_prune(). - The
backoffvalue is stored after a checked addition to ensure it’s valid, however the near-maximum value is still retained. - On the next heartbeat, the node attempts to calculate the expiry time by adding a
slackvalue to the storedbackoff_timeusing unchecked addition, which results in an integer overflow, causing a panic and crashing the application.
Impact
This vulnerability results in a remote, unauthenticated denial of service. Any application exposing an affected libp2p-gossipsub listener can be crashed by a network-reachable peer. The crash occurs during heartbeat processing, not immediately upon receiving the PRUNE message. The attack can be repeated by reconnecting to the target and replaying the crafted PRUNE message. This could lead to service disruptions and potential data loss if the application does not handle crashes gracefully. The number of potential victims is significant, encompassing any application utilizing vulnerable versions of the libp2p-gossipsub library.
Recommendation
- Upgrade the
libp2p-gossipsubdependency to version 0.49.4 or later to patch the unchecked arithmetic operation that causes the overflow. - Deploy the Sigma rule “Detect libp2p Gossipsub PRUNE with Large Backoff” to identify potential exploitation attempts by monitoring network traffic for unusually large
backoffvalues inPRUNEmessages. - Enable network connection logging to capture details of libp2p sessions and identify potential malicious peers attempting to exploit this vulnerability (logsource: network_connection).
Detection coverage 2
Detect libp2p Gossipsub PRUNE with Large Backoff
highDetects abnormally large backoff values within libp2p Gossipsub PRUNE messages, indicating a potential DoS attack.
Detect libp2p Gossipsub Connection Attempts
infoDetects connections to libp2p Gossipsub service.
Detection queries are kept inside the platform. Get full rules →