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

re-entrancy in refund()

Summary

A re-entrancy vulnerability in refund() can allow the attacker to drain all funds.

Vulnerability Details

refund() is sending native ether to the account msg.sender which will trigger a callback if the msg.sender account is a smart contract. Because the state variable players is not cleared for playerIndex before the callback is triggered, an attacker can re-enter refund() and have it send more native ether to msg.sender.

Impact

This will result in all the funds being drained out of the contract.

Tools Used

Manual review

Recommendations

Make the state changes before sending ether or use non-reentrant libraries or locks/mutexes.

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!