Attacker can exploits batch sender role to block result Submissions via fee transfer reversion
The postBatch function allows any address to become the batch sender, which is entitled to receive batch fees. If the batch sender is a contract that reverts on receiving native tokens, the fee transfer in postResult fails, blocking result submissions for that batch.
Schnilch Follow with newspacexyz, rsam_eth and 1 other
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/208
Found by
Schnilch, newspacexyz, rsam_eth, zxriptor
Summary
The postBatch function can be called by any address if all parameters are valid—that is, if the batch includes valid signatures from validators present in s.lastValidatorsRoot and the batch itself is valid. The address that submits the batch becomes its sender and is entitled to receive the batchFee rewards from all results corresponding to that batch. However, if the batch sender is a contract that reverts when receiving native tokens, then the results for that batch cannot be posted.
Root Cause
The postBatch function allows any address to submit a batch as long as the following conditions are met:
1. Batch Height is Greater Than the Previous One
if (newBatch.batchHeight <= s.lastBatchHeight) {
revert InvalidBatchHeight();
}
which is true for upcoming batch
2. Validators in the validatorProofs Are Part of the Latest lastValidatorsRoot
if (!_verifyValidatorProof(validatorProofs[i], s.lastValidatorsRoot)) {
revert InvalidValidatorProof();
}
This validation confirms that each validator who signed the batch is included in the most recent validators root.
3- signatures for batchId are valid and belong to the validators:
if (!_verifySignature(batchId, signatures[i], validatorProofs[i].signer)) {
revert InvalidSignature();
}
4- voting power percentage exceeds the CONSENSUS_PERCENTAGE:
if (votingPower < CONSENSUS_PERCENTAGE) {
revert ConsensusNotReached();
}
This check ensures that the cumulative voting power of the validators who signed the batch exceeds the consensus threshold (typically 66.6%).
Once these validations pass, the state is updated to assign the batch sender to msg.sender: https://github.com/sherlock-audit/2024-12-seda-protocol/blob/main/seda-evm-contracts/contracts/provers/Secp256k1ProverV1.sol#L131
s.batches[newBatch.batchHeight] = BatchData({resultsRoot: newBatch.resultsRoot, sender: msg.sender});
When postResult is later called, after verifying that the result ID is included in the batch’s resultsRoot, the batchFee is sent to the batchSender:
https://github.com/sherlock-audit/2024-12-seda-protocol/blob/main/seda-evm-contracts/contracts/core/SedaCoreV1.sol#L181-L190
if (requestDetails.batchFee > 0) {
if (batchSender == address(0)) {
// If no batch sender, send all batch fee to requestor
refundAmount += requestDetails.batchFee;
} else {
// Send batch fee to batch sender
//@audit batchSender does not accept ether
_transferFee(batchSender, requestDetails.batchFee);
emit FeeDistributed(result.drId, batchSender, requestDetails.batchFee, ISedaCore.FeeType.BATCH);
}
}
If the batchSender is a contract that does not accept native tokens, the fee transfer (and postResult) will fail:
https://github.com/sherlock-audit/2024-12-seda-protocol/blob/main/seda-evm-contracts/contracts/core/SedaCoreV1.sol#L356-L360
function _transferFee(address recipient, uint256 amount) internal {
// Using low-level call instead of transfer()
(bool success, ) = payable(recipient).call{value: amount}("");
if (!success) revert FeeTransferFailed();
}
Internal Pre-conditions
- The contract must not be in a paused state.
- Batch.resultsRoot must not be bytes32(0), meaning it must contain valid results.
External Pre-conditions
- The
postBatchtransaction is processed through a public mempool. - The sender of
postBatchis a contract that does not accept ether in its receive function.
Attack Path
- A very popular DeFi platform relies on the SEDA chain to fetch critical, time-sensitive data and submits 10 requests to the SedaCoreV1 contract.
- A solver submits a
postBatchtransaction containing aresultsRootthat covers the results for these 10 requests, along with results for other requests. - An attacker deploys a contract that reverts when it receives native tokens.
- The attacker front-runs the solver's transaction by offering a much higher gas fee.
- The attacker's transaction is processed, causing the malicious contract to become the batch sender.
- When
postResultis called, it reverts because the batch sender contract does not accept native ens
Impact
- Results for the batch cannot be posted.
- The attack is almost cost-free for the attacker (aside from a negligible gas fee on L2s). An attacker can repeatedly become the batch sender for all batches and block all
postResultrequests.
PoC
No response
Mitigation
Ensure that batch sender is a valid solver:
function postBatch(
SedaDataTypes.Batch calldata newBatch,
bytes[] calldata signatures,
SedaDataTypes.ValidatorProof[] calldata validatorProofs
) external override(ProverBase) whenNotPaused {
if(!validSubmitter[msg.sender]) revert InvalidBatchSender();
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/sedaprotocol/seda-evm-contracts/pull/96
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 postBatch function does not restrict who can be the batch sender, allowing a contract that rejects native tokens to become the sender and cause fee transfers to revert.
Impact
Results for the batch cannot be posted, and an attacker can repeatedly become the batch sender for all batches and block all postResult requests at almost no cost.
What the attacker needed
Contract not paused; Batch.resultsRoot not zero; postBatch in public mempool; Attacker contract rejects native tokens
The fix
The protocol team fixed this issue by restricting batch senders to valid solvers.
How it was found
- Attacker deploys a contract that reverts when it receives native tokens.
- Attacker front-runs the solver's postBatch transaction by offering a higher gas fee.
- Attacker's transaction is processed, making the malicious contract the batch sender.
- When postResult is called, it reverts because the batch sender contract does not accept native tokens.
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.
In this system, someone posts a batch of results and gets a fee. The code lets anyone do this, even a contract that refuses to accept money. If such a contract posts the batch, the fee payment fails, so the results can't be finalised.
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.