Closed c4-bot-10 closed 8 months ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as primary issue
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as duplicate of #235
hansfriese marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2024-03-pooltogether/blob/480d58b9e8611c13587f28811864aea138a0021a/pt-v5-vault/src/PrizeVault.sol#L936
Vulnerability details
Impact
Withdrawals might revert.
Proof of Concept
In PrizeVault:
Per EIP-4626
previewWithdraw()
returns no less than the number of shares that would be burned in awithdraw()
, whileredeem()
must round down (the vault must always be favoured). There is no guarantee that these opposing errors will perfectly cancel out, but either may dominate, depending on implementation and current values. ThusyieldVault.redeem(_yieldVaultShares)
might return less than_assets - _latentAssets
assets, i.e. too few shares were redeemed to bring in the assets required. Then_asset.transfer(_receiver, _assets)
will revert.Recommended Mitigation Steps
Currently the yield buffer is kept in the form of yield vault shares as much as possible by always trying to deposit the remaining assets. Make sure that some amount is also always kept in the form of assets, and deduct this buffer amount from the
_latentAssets
calculation here.Assessed type
Other