Skip to content
DoS Audit finding Intermediate

Unchecked data size in "getStakeTxBlobFromEVMTx()" can use lots of CPU resources

The function that parses staking information from an Ethereum transaction's data field does not check the size of that data. An attacker can send very large data fields in transactions that are destined to fail, causing nodes to spend excessive CPU on parsing.

bountyhunter2048 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#39103 [BC-Insight] Unchecked data size in "getStakeTxBlobFromEVMTx()" can use lots of CPU resources

Submitted on Jan 22nd 2025 at 09:39:16 UTC by @bountyhunter2048 for Audit Comp | Shardeum: Core III

  • Report ID: #39103
  • Report Type: Blockchain/DLT
  • Report severity: Insight
  • Target: https://github.com/shardeum/shardeum/tree/bugbounty
  • Impacts:
    • Increasing network processing node resource consumption by at least 30% without brute force actions, compared to the preceding 24 hours

Description

Brief/Intro

Shardeum embeds staking info in tx.data field of an ethereum tx but it never checks the size of the data field and parse the whatever data attached.

Vulnerability Details

This parsing of staking info const stakeTxString = toAscii(bytesToHex(transaction.data)) never checks the size of transaction.data and allows attacker to inject huge stake txs at constant "5 TPS" and causes nodes to use lots of CPU resources during the parsing.

If the attacker can use powerful machine or execute the script from different machine, he can maintain this attack without time limit because it does not cost him money as these bad txs are destined to fail (due to bad data field).

But, this attack is less dangerous if the attacker uses a single weak machine and unable to keep injecting at least 5 tps.

Here is the vulnerable function: https://github.com/shardeum/shardeum/blob/bugbounty/src/index.ts#L839

Impact Details

Significant increase in the CPU usage as shown in the Demo video. https://youtu.be/7ZHzl-\\_GxQc

References

Attack script: https://gist.github.com/bountyhunter2048/47a63a2566fb4600e900c0a2be442246

Demo attack: https://youtu.be/7ZHzl-\\_GxQc

Link to Proof of Concept

https://gist.github.com/bountyhunter2048/47a63a2566fb4600e900c0a2be442246

Proof of Concept

This simple script creates huge stake tx and injects it repeatedly into the network. The CPU usage of nodes goes up a lot. Attacker can execute it free of charge. Please see the demo video for detail.

https://gist.github.com/bountyhunter2048/47a63a2566fb4600e900c0a2be442246

Demo attack: https://youtu.be/7ZHzl-\\_GxQc

The original report as published on Immunefi, by bountyhunter2048. 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 staking transaction parser converts the entire transaction data field to a string without enforcing a maximum length, so oversized inputs are fully processed.

Impact

Node CPU usage increases significantly, and an attacker with sufficient resources could sustain the attack indefinitely because the failing transactions cost nothing; a single weak machine sending fewer than 5 transactions per second would be less effective.

What the attacker needed

Ability to send transactions to the network; sustained rate of at least 5 transactions per second

How it was found

  1. Create a transaction with a very large data field containing invalid staking information.
  2. Send the transaction repeatedly to the network at a rate of at least 5 transactions per second.
  3. Observe that node CPU usage increases significantly as the nodes parse the oversized data.

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 blockchain node processes transactions, and one step reads a data field to extract staking details. The code never limits how big that field can be, so someone can send enormous data that the node still tries to read. This wastes the node's processing power even though the transaction will eventually fail.

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 bountyhunter2048

View all

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