Christmas Dinner

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

Improper nonReentrant Modifier Implementation

Summary

The nonReentrant modifier resets the locked state to false after executing the function, which does not correctly protect against nested reentrant calls.

Vulnerability Details

If the function guarded by nonReentrant indirectly calls another function using the same modifier, it will reset locked to false, re-enabling reentrancy during execution.

Impact

Allows attackers to exploit reentrancy vulnerabilities, potentially draining funds or manipulating contract state.

Tools Used

Code review.

Recommendations

Refactor the modifier to set locked to true before function execution and reset it afterward:

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

Lead Judging Commences

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

Give us feedback!