Modifiers contract, nonReentrant modifier.
The nonReentrant modifier is susceptible to reentrancy attacks. It only checks the reentrantStatus once at the beginning of the function. If a malicious function can call itself recursively before the reentrantStatus is reset to Constants.NOT_ENTERED, it can potentially execute multiple times and perform reentrant operations.
Proposed Fix:
Consider implementing a more robust reentrancy protection mechanism, such as using the Checks-Effects-Interactions pattern. An example of this pattern has been provided in the previous response.
Code Snippet (Checks-Effects-Interactions Pattern):
modifier nonReentrant() {
require(s.reentrantStatus != Constants.ENTERED, "Reentrant call detected");
s.reentrantStatus = Constants.ENTERED;
_;
s.reentrantStatus = Constants.NOT_ENTERED;
}
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.