User can initiate withdraw for previous epoch if rebase hasn’t been called since end of epoch
The unstake function allowed users to skip the rebase call, leaving the epoch number stale. An attacker could then initiate a withdrawal that was recorded in the previous epoch, letting them withdraw funds earlier than intended.
Submitted by 0x52
User is able to withdraw unstaked asset sooner than they should be.
Proof of Concept
Unstake() allows the user to bypass the rebase() call by setting _trigger to false. Since rebase() is bypassed, epoch.number could potentially be stale i.e. doesn’t match the Tokemak epoch. A user could potentially call unstake() with _trigger = false immediately after an epoch has ended but expiry would be set using the stale epoch.number because it wouldn’t be updated by rebase(). This would allow the user to withdraw early before their funds were actually available in the contract because their withdrawal would be considered to be in the epoch before they actually initiated the withdrawal.
Recommended Mitigation Steps
Rebase() cannot be optional when calling unstake.
toshiSat (Yieldy) acknowledged and commented:
We use a coolDownAmount of 2 to get around this.
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 unstake function allowed bypassing the rebase call, so the epoch number could be stale when calculating withdrawal expiry.
Impact
A user could withdraw their unstaked assets earlier than intended, potentially before the funds are available in the contract.
What the attacker needed
A user with unstaked assets; epoch has ended but rebase not called
The fix
The rebase call should not be optional when calling unstake, or a cooldown mechanism should be used to prevent early withdrawal.
How it was found
- Wait until an epoch has ended but rebase has not been called.
- Call unstake with _trigger set to false to skip rebase.
- The withdrawal expiry is set using the stale epoch number, allowing early withdrawal.
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 smart contract tracks time in epochs. Normally, a rebase function updates the current epoch. The unstake function let users skip that update, so the contract still thought it was in the old epoch. This meant a user could start a withdrawal that was treated as if it happened earlier, allowing them to get their money out before it was actually available.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.