Skip to content
Access control Audit finding Intermediate

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.

000000 Follow with 0xeix, Boy2000 and 6 others

Originally disclosed on Sherlock

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

  1. Attacker observes a Withdraw message with valid proof.
  2. 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

The original report as published on Sherlock, by 000000. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

  1. Attacker observes a Withdraw message with valid proof.
  2. 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.

More by 000000

View all

32 more disclosed reports, best first.

More from SEDA Protocol

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.