Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Overflow Vulnerability in selectWinner Function

Summary

The vulnerability in the "selectWinner" function arises from the use of a uint64 data type to store the "totalFee." .

Vulnerability Details

A uint64 has a maximum value of 18,446,744,073,709,551,615 wei. If at any point during the raffle, the accumulated fees exceed this threshold (18.45 ether), an overflow occurs. When an overflow happens, the value "totalFee" will not be represented correctly due to exceeding the data type's maximum limit

Impact

The overflow vulnerability can have critical consequences, potentially leading to inaccurate representation of fees and disrupting the fair selection of a winner in the raffle. Any surplus fees above the uint64 maximum value will not be captured correctly, affecting the integrity of the raffle and the distribution of funds.

Tools Used

Manual

Recommendations

- uint64 public totalFees = 0;
+ uint256 public totalFees = 0;

    - totalFees = totalFees + uint64(fee);
    + totalFees = totalFees + (fee);
Updates

Lead Judging Commences

Hamiltonite Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

overflow-uint64

Support

FAQs

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