Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Valid

modifier nonReentrant() has a logic flaw

Summary

tstore(0,1), but check tload(1),tload(1) is always 0, so it won't revert

Vulnerability Details

modifier nonReentrant() {
assembly {
if tload(1) { revert(0, 0) }
tstore(0, 1)
}
_;
assembly {
tstore(0, 0)
}
}

Impact

Cannot protect against reentrancy vulnerabilities

Tools Used

Recommendations

modifier nonReentrant() {
assembly {
if tload(0) { revert(0, 0) } //
tstore(0, 1)
}
_;
assembly {
tstore(0, 0)
}
}
Updates

Lead Judging Commences

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

Wrong value in nonReentrant modifier

Support

FAQs

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