#38733 [BC-Medium] nibmus-eth2 remote crash

Submitted on Jan 11th 2025 at 12:17:16 UTC by @gln for Attackathon | Ethereum Protocol

  • Report ID: #38733

  • Report Type: Blockchain/DLT

  • Report severity: Medium

  • Target: https://github.com/status-im/nimbus-eth2

  • Impacts:

    • Shutdown of less than 10% of network processing nodes without brute force actions, but does not shut down the network

Description

Brief/Intro

Nimbus-eth2 does not verify slot number of incoming attestations.

Because it uses checked integer calculations, malformed attestation may crash the node.

Vulnerability Details

Nim signed integer arithmetic is checked, so in case of overflow Defect will be thrown.

Defects inherit from System.Defect, they are not catchable and terminate the running process.

Let's see how incoming attestations are processed https://github.com/status-im/nimbus-eth2/blob/stable/beacon_chain/gossip_processing/eth2_processor.nim#L361

We are interested in attestation_deadline function https://github.com/status-im/nimbus-eth2/blob/stable/beacon_chain/spec/beacon_time.nim#L167

  1. Slot type is basically uint64, if it is very large, start_beacon_time() function will return FAR_FUTURE_BEACONTIME which is equal to int64.high

  2. BeaconTime is int64, so if s.start_beacon_time is int64.high and attestationSlotOffset is not zero, this expression will overflow

As a result OverflowDefect will be thrown and beacon node will stop working

Impact Details

Attacker could crash nimbus-eth2 node with a single malformed attestation.

https://gist.github.com/gln7/034880a75da3dcc3b809798667291273

Proof of Concept

Proof of Concept

To trigger the issue we need to modify attestation before broadcasting it to the network.

How to reproduce:

  1. get nimbus source

  1. apply poc.patch (see gist link)

  2. start localnet

  1. after localnet stops, you can find the following messages in local-testnet-minimal/logs/nimbus_beacon_node.1.jsonl

Was this helpful?