transferfCash does not work as expected
When a user redeems with the option to transfer fCash after maturity, the contract cashes out the fCash into the underlying token and sends that to the receiver instead of transferring fCash. The sender receives no error and believes the fCash transfer succeeded.
Originally disclosed on Code4rena
Submitted by csanuragjain
If maturity is reached and user has asked for redeem with opts.transferfCash as true, then if (hasMatured()) turns true at wfCashLogic.sol#L216 causing fcash to be cashed out in underlying token and then sent to receiver. So receiver obtains underlying when fcash was expected. The sender wont get an error thinking fcash transfer was success
Proof of Concept
- User A calls redeem with opts.transferfCash as true and receiver as User B
- Since maturity is reached so instead of transferring the fCash, contract would simply cash out fCash and sent the underlying token to the receiver which was not expected
Recommended Mitigation Steps
If opts.transferfCash is true and maturity is reached then throw an error mentioning that fCash can no longer be transferred
Sounds reasonable.
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 redeem function checks maturity and cashes out fCash before considering the transferfCash option, so the transfer path is skipped when hasMatured() is true.
Impact
The receiver gets the underlying token instead of fCash, and the sender is not notified of the unexpected behaviour.
What the attacker needed
FCash has reached maturity; caller uses redeem with transferfCash option
The fix
The contract should throw an error if opts.transferfCash is true and maturity has been reached, stating that fCash can no longer be transferred.
How it was found
- User A calls redeem with opts.transferfCash set to true and receiver set to User B.
- Because maturity is reached, the contract cashes out the fCash and sends the underlying token to the receiver instead of transferring fCash.
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.
fCash is a token representing a future cash flow. When it matures, it can be redeemed for the actual underlying token. The code was supposed to transfer fCash to another user, but after maturity it instead converted the fCash to the underlying token and sent that, without telling the sender.
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.