Data requests queue can be DoS'ed
The SEDA chain allows anyone to post data requests by paying only gas, with gas parameters set by the caller, so an attacker can create thousands of cheap requests that expire and flood the tallying queue. This can slow the chain and cause legitimate requests to time out.
Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/53
Found by
zxriptor
Summary
Posting data requests on the SEDA chain is permissionless and does not incur fees. This can be exploited by creating thousands of dummy and cheap data requests that will never be executed by executors but, once expire, they will bloat the processing queue.
Root Cause
To post a data request, a caller only needs to pay enough tokens to cover gas for the request processing:
let required = (Uint128::from(self.posted_dr.exec_gas_limit) + Uint128::from(self.posted_dr.tally_gas_limit))
.checked_mul(self.posted_dr.gas_price)?;
if funds < required {
return Err(ContractError::InsufficientFunds(
required,
get_attached_funds(&info.funds, &token)?,
));
};
However, exec_gas_limit, tally_gas_limit, and gas_price are input parameters specified by the caller hence they can be set low to result in charges of 1 or a few units of aseda tokens.
Such results will likely be ignored by executors as the rewards are negligent, however, they will be included in the processing (tallying) after the timeout period passed:
pub fn expire_data_requests(&self, store: &mut dyn Storage, current_height: u64) -> StdResult<Vec<String>> {
// remove them from the timeouts and return the hashes
let drs_to_update_to_tally = self.timeouts.remove_by_timeout_height(store, current_height)?;
drs_to_update_to_tally
.into_iter()
.map(|hash| {
// get the dr itself
let dr = self.get(store, &hash)?;
// update it to tallying
@> self.update(store, hash, dr, Some(DataRequestStatus::Tallying), current_height, true)?;
Ok(hash.to_hex())
})
.collect::<StdResult<Vec<_>>>()
}
By creating thousands of such data requests an attacker can bloat a processing queue and prevent legitimate requests from processing in time. As can be seen from the following code snippet, only a limited set of data requests can be handled in a block:
It is worth noting that even a negligible amount paid by the attacker for data request processing will be refunded to them after the processing pipeline is completed.
Attack Path
- Attacker creates 1000s of data requests
- All these requests time out
- x/tally module processes only a single page limited to
params.MaxTalliesPerBlockpotentially consisting of the attacker's fake requests only.
Impact
- Chain slowdown
- Legitimate requests time out
PoC
No response
Mitigation
Introduce a data request fee or make a data request call permissioned to the whitelisted solvers
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/sedaprotocol/seda-chain-contracts/pull/277
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
The gas parameters that determine the fee for a data request are caller-controlled, allowing requests to be posted for a negligible cost.
Impact
The chain may slow down and legitimate data requests may time out.
What the attacker needed
No special access needed; ability to post data requests on SEDA chain
The fix
The protocol team fixed this issue by introducing a data request fee or making data requests permissioned to whitelisted solvers.
How it was found
- Attacker creates thousands of data requests with very low gas parameters.
- The requests expire without being executed by executors.
- The tally module processes only a limited number of expired requests per block, potentially all from the attacker.
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 lets people submit requests to do work. Here, submitting a request costs almost nothing because the person chooses how much to pay for processing. An attacker can flood the system with many useless requests, and when they expire, the system has to process them, which takes time away from real requests.
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.