MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

Re-entrancy Attack Risk

Summary

The claimCut function transfers tokens before updating the contract's state, exposing it to re-entrancy attacks.

Vulnerability Details

If a malicious contract calls claimCut, it can re-enter the function before the state is updated, leading to multiple claims of rewards.

Impact

This allows a malicious actor to drain the contract's funds, leading to severe financial loss.

Tools Used

Manual review

Proof of Concept

This vulnerability occurs because of the token transfer:

_transferReward(player, reward); // Transfer before updating state
playersToRewards[player] = 0; // State update after transfer

Recommendations

Implement the Checks-Effects-Interactions pattern by updating the state before transferring tokens.

playersToRewards[player] = 0;
remainingRewards -= reward;
claimants.push(player);
_transferReward(player, reward);
Updates

Lead Judging Commences

equious Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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