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

`ThePredicter::withdraw()` sends eth to arbitrary user which can be vulnerable to reentrancy attacks. There is also a reentrancy in `ThePredicter::cancelRegistration()`.

Summary

Unprotected call to a function sending Ether to an arbitrary address.

Vulnerability Details

Dangerous calls in ThePredicter::withdraw():

- (success,None) = msg.sender.call{value: reward}() (src/ThePredicter.sol#141)

External calls in ThePredicter::cancelRegistration():

- (success,None) = msg.sender.call{value: entranceFee}() (src/ThePredicter.sol#64)
State variables written after the call(s):
- playersStatus[msg.sender] = Status.Canceled (src/ThePredicter.sol#66)
ThePredicter.playersStatus (src/ThePredicter.sol#24) can be used in cross function reentrancies:
- ThePredicter.approvePlayer(address) (src/ThePredicter.sol#72-83)
- ThePredicter.cancelRegistration() (src/ThePredicter.sol#62-70)
- ThePredicter.playersStatus (src/ThePredicter.sol#24)
- ThePredicter.register() (src/ThePredicter.sol#46-60)

Impact

The means of how the calls are used make the functions vulnerable to reentrancy attacks.

Tools Used

Slither

Recommendations

Ensure that an arbitrary user cannot withdraw unauthorized funds. Use ReentrancyGuard from OpenZeppelin or checks-effects-interactions pattern.

Updates

Lead Judging Commences

NightHawK Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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