The goal of the nonReentrant
guard is to prevent reentrancy attacks in smart contracts.
In the nonReentrant
modifier, there is no setter for setting the locked
flag to true
. As a result, the locked
flag always remains false
.
Please compare the nonReentrant
modifier with OpenZeppelin's implementation of this modifier. In OpenZeppelin's implementation, there is a function _nonReentrantBefore
where the proper status for the locked
flag is set.
In the protocol is only check, but there is not setter to locked=true
The custom implementation of nonReentrant
is not secure and does not provide a proper guard against reentrancy attacks. As a result, all funds within the protocol could be vulnerable to hacking.
manual review
I recommend using OpenZeppelin's implementation of the nonReentrant
modifier instead of a custom solution. OpenZeppelin's implementation is widely tested and trusted, ensuring proper protection against reentrancy attacks. Alternatively, you could modify the custom modifier, but this approach is not recommended due to the complexities and potential security risks involved. Sticking with OpenZeppelin's solution ensures robustness and reliability.
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.