Submitted by mahyar
In PrizePool.sol vaults can call the claimPrize() function to claim prizes for winners. The claimPrize calls _getTier(_tier, numberOfTiers) function to get back the prizeSize but there is a problem in the _getTier function:
As you can see, it calls the _computePrizeSize function and downcasts the returned result. Since it returns uint256 by downcasting it to uint96, its possible to result in the incorrect number in the value overflow. When downcasting from one type to another, Solidity will not revert, but overflows.
This means, there is a possibility the prizeSize value will result in the incorrect prize size and vaults cant claim the prizes correctly for winners.
Check whether the result of prizeSize exceeds type(uint96).max or not, if so, revert the tx. I recommend to use SafeCast by OpenZeppelin for casting different types safely.
I also found some other downcastings in the codebase, but since they are pegged to vault share values and you already check for overflows, there is no problem.
Under/Overflow
asselstine (PoolTogether) confirmed and commented:
Picodes (judge) decreased severity to Medium and commented:
asselstine (PoolTogether) commented:
PoolTogether mitigated:
Status: Mitigation confirmed. Full details in reports from 0xStalin and dirk_y.
