Closed c4-bot-1 closed 8 months ago
totalDebt_ is 0 leading to division by zero doesn't make sense given that assets would have been 0 too and 0 is being returned here:
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as duplicate of #71
hansfriese marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2024-03-pooltogether/blob/main/pt-v5-vault/src/PrizeVault.sol#L350 https://github.com/code-423n4/2024-03-pooltogether/blob/main/pt-v5-vault/src/PrizeVault.sol#L364 https://github.com/code-423n4/2024-03-pooltogether/blob/main/pt-v5-vault/src/PrizeVault.sol#L382
Vulnerability details
Impact
PrizeVault
doesn't strictly follow the rules for an EIP4626 contract. The following functions are non-compliant:Proof of Concept
EIP4626 states the following:
However we can see that in
PrizeVault::convertToAssets
will revert iftotalDebt_
is 0 (due to division by zero error). This can happen for example if all the users withdrew their balances and claimed rewards andyieldFeeBalance
>_asset.balanceOf(address(this))
.And we can see the
maxDeposit
function inPrizeVault
:And indeed it depends on
_latentBalance
which is the balanceOf.There is no check in
PrizeVault::deposit
orPrizeVault::mint
to check that users don't deposit more thanmaxDeposit
which opposes the EIP.The same goes for
maxMint
.Tools Used
Manual Review
Recommended Mitigation Steps
Review https://eips.ethereum.org/EIPS/eip-4626 and follow the stated rules.
Assessed type
ERC4626