Skip to content

Remote memory exhaustion in ckb

High severity GitHub Reviewed Published Jul 26, 2021 in nervosnetwork/ckb • Updated Jan 11, 2023

Package

cargo ckb (Rust)

Affected versions

< 0.40.0

Patched versions

0.40.0

Description

In the ckb sync protocol, SyncState maintains a HashMap called 'misbehavior' that keeps a score of a peer's violations of the protocol. This HashMap is keyed to PeerIndex (an alias for SessionId), and entries are never removed from it. SessionId is an integer that increases monotonically with every new connection.

A remote attacker can manipulate this HashMap to grow forever, resulting in degraded performance and ultimately a panic on allocation failure or being killed by the OS, depending on the platform.

This is a critical severity security bug. It could be exploited to create a targeted or network-wide denial of service, to reduce the hash power of the network as part of a 51% attack, and perhaps in other creative ways.

An attack is trivial:

  1. connect to another node
  2. send an invalid sync protocol request, such as SendHeaders for non-consecutive blocks
  3. disconnect
  4. repeat

References

@doitian doitian published to nervosnetwork/ckb Jul 26, 2021
Reviewed Aug 2, 2021
Published to the GitHub Advisory Database Aug 25, 2021
Last updated Jan 11, 2023

Severity

High

Weaknesses

CVE ID

No known CVE

GHSA ID

GHSA-48vq-8jqv-gm6f

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.