The EggVault::withdrawEgg function modifies state variables after making an external call, violating the checks-effects-interactions pattern and creating a potential reentrancy vulnerability.
The withdrawEgg function updates state variables before making an external call to transfer the NFT:
While direct reentrancy with the same token ID is prevented by the state changes, this pattern still violates best practices and could be vulnerable to cross-function reentrancy attacks.
Potential for cross-function reentrancy attacks
Could be exploited in combination with other contracts or protocols
Violates smart contract security best practices
The severity is medium rather than high because:
Direct reentrancy with the same token ID is prevented by state changes
The NFT contract uses _mint instead of _safeMint, limiting callback opportunities
The impact is constrained by the unique nature of NFTs
Manual code review
Implement a reentrancy guard and follow the checks-effects-interactions pattern:
This change adds the OpenZeppelin ReentrancyGuard and applies the nonReentrant modifier to the withdrawEgg function, preventing any reentrancy attacks.
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.