A vulnerability was identified in the _redeemWToken, _redeemPositionToken, and _removeLiquidity functions. These functions rely on the _redeemWTokenPrivate function, which demonstrates unsafe behavior when handling failed token transfers. This flaw can result in the permanent loss of wrapped tokens (wTokens) without successfully receiving the equivalent underlying tokens, particularly in scenarios involving blacklisted USDC accounts, problematic ERC-20 tokens with non-standard transfer behaviors, or if the reserve is paused.
If the transfer of the underlying tokens fails after burning wTokens, or the reserve is paused, the funds are effectively lost, creating severe implications for users.
The root cause of the vulnerability lies in the _redeemWTokenPrivate function, where the burn operation for wTokens occurs before the withdrawal of the underlying tokens. If the token transfer fails, the wTokens are already burned, but no tokens are returned to the user. This creates a situation where user funds are effectively stuck or permanently lost.
This can lead to the permanent loss of user funds.
Manual Code Review
To mitigate this issue and prevent the loss of user funds, the following changes are recommended:
Reorder Operations in _redeemWTokenPrivate: Perform the withdrawal operation before burning the wTokens. This ensures that the wrapped tokens are only burned after confirming the successful transfer of the underlying tokens.
2. Add a check to handle paused reserves in Aave or other protocols. If a reserve is paused, revert the transaction gracefully before burning the wTokens. Use the getReserveData function from Aave to determine the reserve's status.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.