Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

No Reentrancy Protection in claimReward

Summary

The function sends Ether to the user before updating internal state, violating the checks-effects-interactions pattern. This enables classic reentrancy attacks.

Vulnerability Details

function claimReward() public {
payable(msg.sender).transfer(rewardAmount);
rewardAmount = 0;
}

A malicious contract could use a fallback function to re-enter the claim and drain funds multiple times.

Impact

Complete contract drain via reentrancy.

Tools Used

  • Manual audit

  • Foundry fallback-based reentrancy simulation

Recommendations

Use ReentrancyGuard and correct ordering:

function claimReward() public nonReentrant {
uint256 amount = rewardAmount;
rewardAmount = 0;
payable(msg.sender).transfer(amount);
}
Updates

Appeal created

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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