Withdrawable.withdraw does not decrease pendingWithdrawals
The withdraw function does not decrease the pendingWithdrawals storage variable, so it overstates outstanding withdrawals. This causes getReserveBalance to under-report the actual reserve balance, leading to incorrect mint amounts in the FSD.mint calculation.
FairSide contest
Originally disclosed on Code4rena
The name pendingWithdrawals indicates that this storage variable tracks the withdrawals that need yet to be paid out. Furthermore, this matches the behavior in _increaseWithdrawal. As such, it should be decreased when withdrawing in withdraw, but it is not.
The getReserveBalance function consistently under-reports the actual reserve balance, which leads to the wrong mint amounts being used in the FSD.mint calculation.
Recommend decreasing pendingWithdrawals by the withdrawn amount.
fairside-core (FairSide) confirmed (in duplicate issue #72)
One of two easter eggs! Fixed in PR#5.
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 withdraw function fails to decrease the pendingWithdrawals variable by the withdrawn amount, unlike _increaseWithdrawal which correctly increases it.
What the attacker needed
None
The fix
The issue was fixed by decreasing pendingWithdrawals by the withdrawn amount in the withdraw function.
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 keeps track of how much money is owed to people who have requested withdrawals. When someone actually withdraws, the contract should reduce that owed amount, but it does not. This makes the contract think it owes more than it does, so it calculates the reserve balance incorrectly and mints the wrong number of tokens.
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.