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

enterRaffle() not checking 0-size array results in DoS

Summary

No check is made for an empty array in enterRaffle().

Vulnerability Details

If an argument of enterRaffle() is a zero-size array the function gets stuck. The following test can demonstrate the issue and will basically freeze the contract:

function testCanEnterWithoutPlayers() public {
address[] memory players = new address[](0);
puppyRaffle.enterRaffle(players);
}

Impact

High. Vulnerability can be used to perform denial-of-service.

Tools Used

Manual check.

Recommendations

Revert, if an empty array is provided in args:

require(newPlayers.length > 0, "PuppyRaffle: no players");
Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Other
wallebach Submitter
about 2 years ago
patrickalphac Lead Judge
about 2 years ago
Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Other
Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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

Give us feedback!