Christmas Dinner

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

Reentrance logic is not setting a lock before execution of function

Summary

The nonReentrant function is not setting the value of the locked varaible to true before executing the logic that is sensetive to reentrance.

Vulnerability Details

The nonReentrant function is executing function that are sensetive to reentrance without using the lock mutex properly. In order to follow the correct logic we need to set the locked varaible to true before executing the sensetive code and the release the mutex by setting the value back to false after code execution.

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

Impact

The refund function is now vulnerabule to reentrant attacks as the mutex has no impact.

Tools Used

  • Manual Review

Recommendations

Set the value of the locked varaible to true before executing the sensetive to reentrance code logic.

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!