Skip to content
DoS Disclosed report Intermediate

Memory Exhaustion in CometBFT v1.0.1 via malicious ProposalMessage leads to network-wide denial of service

CometBFT v1.0.1 fails to validate the PartSetHeader.Total field in a ProposalMessage before allocating memory, so an attacker can send a tiny P2P message that forces the node to allocate 512 MB and crash. By crashing enough validators, an attacker can halt consensus across the whole network.

0xjam Follow

Originally disclosed on HackerOne

  • Disclosed after 6 days

Summary of Impact

CometBFT v1.0.1 contains a critical memory exhaustion vulnerability that allows any peer to crash nodes with a single ~50-byte P2P message. An attacker can send a malicious ProposalMessage with PartSetHeader.Total set to 2^32-1, causing the receiving node to immediately allocate 512 MB of memory without prior validation, resulting in an OOM kill.

The impact is complete network denial of service. For a 69-validator network (like Berachain mainnet), an attacker can halt consensus by crashing just 23 validators (34%) with only 1.15 KB of bandwidth.

Severity: HIGH/CRITICAL (depends on chain, if being validator is permissionless etc)

Steps to Reproduce

  1. Create a malicious ProposalMessage with PartSetHeader.Total set to 2^32-1 (4,294,967,295)
  2. Connect to a target node running CometBFT v1.0.1 via P2P protocol
  3. Send the malicious message to the target node
  4. The node will immediately allocate 512 MB of memory and be terminated by the OOM killer

Vulnerable code path:

  • Entry point: internal/consensus/reactor.go:334-336 - No validation before processing
  • Unvalidated allocation: internal/consensus/reactor.go:1169 - Attacker controls Total value
  • Unsafe allocation: internal/bits/bit_array.go:31 - Unbounded memory allocation
  • Validation that never executes: internal/consensus/state.go:2075-2077 - Too late in execution flow

A second vulnerability vector exists in InitProposalBlockParts() at reactor.go:1184 which may be exploitable via NewValidBlockMessage or other message types.

Workarounds

No effective mitigation exists without a code patch. Operators must manually restart nodes after they crash.

Supporting Material/References

  • Proof of Concept:
Go
package main

import (
    "math"
    "github.com/cometbft/cometbft/types"
    cmtcons "github.com/cometbft/cometbft/api/cometbft/consensus/v1"
)

func main() {
    // Create malicious proposal
    proposal := types.NewProposal(1, 0, -1, types.BlockID{
        Hash: make([]byte, 32),
        PartSetHeader: types.PartSetHeader{
            Total: math.MaxUint32,  // 2^32-1 = 4,294,967,295
            Hash:  make([]byte, 32),
        },
    }, nil)
    proposal.Signature = []byte{0x01}
    
    // Send to target node on port 26656
    // (P2P connection and handshake code omitted for brevity)
    
    // Result: Target node crashes within 10ms
}
  • Affected networks include Berachain mainnet (69 validators) and potentially all blockchain networks using CometBFT v1.0.1
  • Upstream v0.38.20 version correctly mitigates the issue

The original report as published on HackerOne, by 0xjam. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the code allocates memory based on an attacker-controlled count (PartSetHeader.Total) before validating that the count is reasonable.

Impact

An attacker could crash individual nodes and, by crashing enough validators, halt consensus for the entire network; no effective mitigation exists without a code patch.

What the attacker needed

Network access to a CometBFT node's P2P port; target runs CometBFT v1.0.1

The fix

The issue should be fixed by validating the PartSetHeader.Total value before allocating memory; the text notes that upstream v0.38.20 correctly mitigates the issue.

How it was found

  1. Create a malicious ProposalMessage with PartSetHeader.Total set to 2^32-1.
  2. Connect to a target node running CometBFT v1.0.1 via the P2P protocol.
  3. Send the malicious message to the target node.
  4. The node allocates 512 MB of memory and is terminated by the OOM killer.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A blockchain node needs to check incoming messages before using them to reserve memory. Here, a tiny message told the node to reserve a huge amount of memory, and the node did so without checking, so it ran out of memory and was killed. If enough nodes are killed, the blockchain stops working.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from Cosmos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.