DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: medium
Invalid

Reentrancy Vulnerability in nonReentrant Modifier

Location:

Modifiers contract, nonReentrant modifier.

Description:

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;
}

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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