Christmas Dinner

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

modifier nonReentrant() doesn't prevent Reentrancy

Summary

modifier nonReentrant() doesn't prevent Reentrancy

Vulnerability Details

On line 77 of ChristmasDinner.sol there is the followin modifier:

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

The issue is that the variable "locked" is always "false" in the code, it never changes value.

Impact

A Reentrancy attack could be used when the contract relies on a modifier that doesn't work.

Tools Used

Manual analysis.

Recommendations

Change the variable to "true" after the require check.

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

Lead Judging Commences

0xtimefliez Lead Judge 7 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.