Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

Reentrancy Risk in refund Function

Summary

The nonReentrant modifier relies on a locked variable that is set to false after the function body executes.
If _refundETH or _refundERC20 interacts with malicious contracts, they can exploit this to re-enter the function.

Vulnerability Details

modifier nonReentrant() {
require(!locked, "No re-entrancy");
_;
locked = false;
}

Impact

Attackers can repeatedly call refund and withdraw more funds than intended, leading to a complete loss of contract funds

Tools Used
manual review

Recommendations

Update the nonReentrant modifier to set locked = true before entering the function and reset it after execution. Alternatively, use OpenZeppelin’s ReentrancyGuard.

modifier nonReentrant() {
require(!locked, "No re-entrancy");
locked = true; // Lock before execution
_;
locked = false; // Unlock after execution
}

Updates

Lead Judging Commences

0xtimefliez Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

mutex lock incomplete

Support

FAQs

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