Skip to content
DoS Audit finding Beginner

Crashing all Validators Vulnerability in eth_g

The eth_getBlockByHash endpoint reads the length of the blockHash query parameter without checking if it is defined, so a request without that parameter throws an uncaught error and crashes the validator process. An attacker with a list of validator IPs could crash all validators, causing a total network shutdown.

infosec_us_team Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

32982 - [BC - Critical] Crashing all Validators Vulnerability in eth_g...

Submitted on Jul 9th 2024 at 02:18:11 UTC by @infosec_us_team for Boost | Shardeum: Core

Report ID: #32982

Report type: Blockchain/DLT

Report severity: Critical

Target: https://github.com/shardeum/shardus-core/tree/dev

Impacts:

  • Network not being able to confirm new transactions (total network shutdown)

Description

Brief/Intro

In this report, we demonstrate how sending one specially crafted HTTP request to any Validator can crash him (shut him down).

With a list of validator IPs, an attacker can crash all of them at any time.

Vulnerability Details

The vulnerability exists in the endpoint '/eth_getBlockByHash'. Below is the code for the function as a reference.

  shardus.registerExternalGet('eth_getBlockByHash', externalApiMiddleware, async (req, res) => {
    /* eslint-disable security/detect-object-injection */
    let blockHash = req.query.blockHash as string
    if (blockHash === 'latest') blockHash = readableBlocks[latestBlock].hash
    else if (blockHash.length !== 66 || !isHexString(blockHash))
      return res.json({ error: 'Invalid block hash' })
    if (ShardeumFlags.VerboseLogs) console.log('Req: eth_getBlockByHash', blockHash)
    const blockNumber = blocksByHash[blockHash]
    return res.json({ block: readableBlocks[blockNumber] })
    /* eslint-enable security/detect-object-injection */
  })

Outside of a try catch block, the endpoint attempts to access the value of the URL param blockHash, and then it tries to read its length.

If the param was not set, the variable blockHash will be of type undefined, and reading the length returns the error: Cannot read property 'length' of undefined, and stops the running process.

Attack Vector

Visiting the URL http://VALIDATOR\\_IP:9002/eth\\_getBlockByHash? (notice we are not providing the blockHash param), replacing VALIDATOR_IP with the IP address of any validator in the blockchain will crash him (shut him down).

Impact Details

Network not being able to confirm new transactions (total network shutdown)

Proof of Concept

For a proof of concept, follow the instructions to run the Shardeum server locally or remotely and visit the URL http://VALIDATOR\\_IP:9002/eth\\_getBlockByHash? replacing VALIDATOR_IP with the IP address.

The node will be shut down, any subsequent request to this IP and Port will fail, and the Network Monitor at http://VALIDATOR\\_IP:3000/ will show as well after a couple of minutes one less validator.

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

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

The endpoint accesses the length property of the blockHash query parameter without first checking that it exists, and the error is not caught.

Impact

An attacker could crash all validators, leading to a total network shutdown where new transactions cannot be confirmed.

What the attacker needed

Knowledge of validator IP addresses; network access to validator port 9002

How it was found

  1. Identify the IP address of a validator.
  2. Send an HTTP request to the validator on port 9002 at the path /eth_getBlockByHash without the blockHash query parameter.
  3. Observe that the validator process shuts down and subsequent requests fail.

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 validator is a computer that helps run the blockchain network. The endpoint expects a block hash in the URL, but if it is missing, the code tries to read the length of nothing, which causes an error that is not caught and shuts down the program. An attacker can send a simple request without the hash to crash any validator.

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 by infosec_us_team

View all

31 more disclosed reports, best first.

More from Shardeum: Core

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.