Anyone can post a request with `gasPrice` of 0 to cause SEDA chain to halt
The SEDA Chain core contract does not validate that a data request's gasPrice is non-zero. When the Tally module later uses gasPrice as a divisor in a gas calculation, a zero value causes a division-by-zero panic that crashes all validator nodes, halting the chain.
Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/235
Found by
g
Summary
There are no validations preventing a data request's gasPrice to be zero. When the SEDA Chain tallies data requests, it uses gasPrice
as a divisor in one of its gas calculations. A zero gasPrice leads to a division-by-zero that crashes all validator nodes.
Root Cause
- In SEDA Chain's Core contract, no validation is done on the value of the
gasPricewhen posting a request. - In SEDA Chain's Tally module, it uses
gasPriceas the divisor when metering the gas for proxies.
gasUsedPerExecInt := proxyConfig.Fee.Amount.Quo(gasMeter.GasPrice())
Internal Pre-conditions
None
External Pre-conditions
None
Attack Path
- An attacker can post a valid request with
gasPriceof 0,replicationFactorof 1, and no filters. - Once the request has been commit-revealed by a validator, whether maliciously or unwittingly, it will be processed by the SEDA Chain's
Tally module Endblock().
3. Since no filtering is applied, there will be no filtering errors and it attempts to meter the gas for the proxies. The node will then panic and crash.
4. Every validator node will process this data request since it has a "Tallying" status and they will all crash until the issue is resolved.
Impact
This causes all validator nodes to crash indefinitely, leading to a Chain halt.
PoC
None
Mitigation
Consider validating that the gasPrice is non-zero before using it as a divisor or checking that gasPrice is a minimum non-zero value.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/sedaprotocol/seda-chain/pull/530 https://github.com/sedaprotocol/seda-chain-contracts/pull/277 https://github.com/sedaprotocol/seda-evm-contracts/pull/98
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 missing validation of gasPrice being non-zero before it is used as a divisor in the Tally module's gas metering.
Impact
All validator nodes crash indefinitely, leading to a chain halt.
What the attacker needed
Ability to post a data request
The fix
The protocol team fixed this issue by validating that gasPrice is non-zero before using it as a divisor.
How it was found
- Post a valid data request with gasPrice set to 0, replicationFactor 1, and no filters.
- Wait for a validator to commit-reveal the request.
- The Tally module processes the request at Endblock and attempts to meter gas for proxies.
- The node panics due to division by zero, and all validator nodes crash.
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 has rules that stop bad inputs from breaking it. Here, a number called gasPrice was allowed to be zero, and later the system divided by that number, which is impossible and crashes the program. Because every validator runs the same code, they all crash together and the chain stops.
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.