Submitted by CodeWasp, also found by Al-Qa-qa, d3e4, 0xmystery, and Drynooo
All of the users funds are unretrievably locked in the PrizeVault contract.
A combination of issues allows for the following scenario:
The exploit relies on insufficient handling of two corner cases of ERC-20 and ERC-4246:
While this is the most standards-compliant scenario, a malicious vault could simply not transfer the required tokens on purpose, and still trigger the same effect as described above.
We provide a proof of concept that results in all of Alices assets locked in the PrizeVault contract and all her shares burned.
Place the file below in test/unit/PrizeVault/PoCLockedFunds.t.sol and run the test with:
We recommend to fix both the ERC-20 transfer and ERC-4626 withdrawal.
For the first, it is easiest to rely on OpenZeppelins SafeERC20 safeTransfer function:
This already mitigates the erroneous locking of assets.
In addition, we recommend to ensure that at least the necessary amount of shares is withdrawn from the yield vault.
In the simplest form, this can be ensured by invoking withdraw directly:
If a tighter bound on redeemed shares is desired, the call to previewWithdraw/redeem should be followed by a withdraw of the outstanding assets:
ERC20
trmid (PoolTogether) confirmed and commented:
hansfriese (judge) decreased severity to Medium and commented:
