Attacker can front-run Withdraw and steal the withdrawal
The Withdraw message in the Seda Core contract sends withdrawn tokens to the message sender without verifying that the sender is the legitimate staker. An attacker can front-run a valid withdrawal with the same message and steal the withdrawn amount.
Source: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/231
Found by
000000, 0xeix, Boy2000, DeLaSoul, cu5t0mPe0, dod4ufn, g, leopoldflint, zxriptor
Summary
The Withdraw message in the Seda Core contract sends the withdrawn tokens to the message sender. This enables anyone to front-run the withdrawal with the same message to steal the withdrawn amount.
Root Cause
- The withdrawn tokens are sent to the message sender.
let bank_msg = BankMsg::Send {
to_address: info.sender.to_string(),
amount: coins(self.amount.u128(), token),
};
- No checks are done on the message sender, so it can be anyone.
Internal Pre-conditions
None
External Pre-conditions
None
Attack Path
- Attacker observes a Withdraw message with valid proof.
- Attacker frontruns the Withdraw copying the same message to steal the withdrawn amount.
Impact
Permanent loss of funds for the Staker.
PoC
No response
Mitigation
Consider sending the withdrawn tokens to a pre-approved address instead of the info.sender.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/sedaprotocol/seda-chain-contracts/pull/272
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
Impact
Permanent loss of funds for the Staker.
What the attacker needed
Attacker can observe a valid withdrawal message; attacker can front-run transactions
The fix
The withdrawn tokens should be sent to a pre-approved address instead of the message sender.
How it was found
- Attacker observes a Withdraw message with valid proof.
- Attacker front-runs the Withdraw by copying the same message to steal the withdrawn amount.
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.
When you withdraw tokens from a smart contract, the contract should send them to you, not to whoever submitted the withdrawal request. Here, the contract sent tokens to the sender of the message, so an attacker could copy a valid withdrawal request and submit it first, receiving the tokens instead of the real owner.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.