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

Malicious User can drain all funds from the ThePredicter.sol

Summary

A malicious user can drain all funds from ThePredicter.sol by calling ThePredicter.sol::cancelRegistration() and re-entering it before the end of execution.

Details

The organisation of ThePredicter.sol::cancelRegistration() where it makes external call before updating state makes it vulnerable to re-entrancy attacks where a user can drain all funds by recalling this function in an external contract hence transferring all the funds to this contract.

Impact

All the funds in the contract will be stolen, leaving to spend.

Tools Used

Manual Review

Recommendation

Reorganise the ThePredicter.sol::cancelRegistration() function such that state changes of the contract are updated before any external calls. Follow the checks, effect, calls order.

Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Reentrancy in cancelRegistration

Reentrancy of ThePredicter::cancelRegistration allows a maliciour user to drain all funds.

Support

FAQs

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