code-423n4 / 2023-07-pooltogether-findings

12 stars 7 forks source link

Silent overflow could alter computation when calculating the vaultPortion in the PrizePool contract #243

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/GenerationSoftware/pt-v5-prize-pool/blob/4bc8a12b857856828c018510b5500d722b79ca3a/src/PrizePool.sol#L962-L970

Vulnerability details

Impact

Note:

Even though the bot reported issues about downcasting variables, it didn't mention this specific unsafe casting, which if an overflow occurs could cause a huge impact on the calculation of the vault portions.

Proof of Concept

Tools Used

Manual Audit

Recommended Mitigation Steps

Assessed type

Under/Overflow

asselstine commented 1 year ago

The DrawAccumulator stores the available balance as uint96, but we could definitely tighten up the data types and make casting safe.

c4-sponsor commented 1 year ago

asselstine marked the issue as sponsor confirmed

c4-judge commented 1 year ago

Picodes marked the issue as satisfactory

asselstine commented 1 year ago

Fixed in https://github.com/GenerationSoftware/pt-v5-prize-pool/pull/22

asselstine commented 1 year ago

Fixed in https://github.com/GenerationSoftware/pt-v5-prize-pool/pull/22