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

Refund Reentrancy Can Drain Raffle Contract

Summary

A malicious contract can drain the puppy raffle contract through reentrancy in the refund() function.

Vulnerability Details

A malicious contract can deposit once as the entry fee and immediately call refund(). Then in the fallback, continue to call the refund function while the contract balance is still above or equal to the entrancyFee.

Since there is no reentrancy guard and since the raffle contract is not following CEI or FREI-PI pattern, the contract is vulnerable.

Impact

The contract can be drained of its ETH.

Tools Used

manual review

Recommendations

Add a reentrancy modifier like OpenZeppelin's nonReentrant and follow CEI or FREI-PI patterns to prevent reentrancy risk.

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

reentrancy-in-refund

reentrancy in refund() function

Support

FAQs

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

Give us feedback!