Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: high

integer Overflow on Amount Calculation `Distributor.sol`

Summary

An integer overflow could occur when calculating winner payout amounts.

Vulnerability

The amount calculation uses:

uint amount = totalAmount * percentages[i] / BASIS_POINTS;

This could overflow if totalAmount * percentages[i] exceeds type(uint256).max.

For example, with totalAmount = 50 ether and percentages[i] = 20000.
Impact

Incorrect winner payout amounts. Could lead to loss of funds.

Tools Used

Manual

Recommendations

Use SafeMath to prevent overflows:

using SafeMath for uint;
uint amount = totalAmount.mul(percentages[i]).div(BASIS_POINTS);

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.