Skip to content
Business logic Audit finding Intermediate

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.

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

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.

More from FairSide contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.