The withdrawEgg function in the vault contract lacks reentrancy protection, enabling attackers to recursively withdraw deposited Egg NFTs multiple times, potentially draining the vault.
Attack Vector:
The safeTransferFrom call triggers the NFT receiver's onERC721Received function before updating the vault's internal state (_removeDeposit). A malicious NFT contract can re-enter withdrawEgg during this window.
Exploit Scenario:
Attacker deploys a malicious NFT contract implementing onERC721Received
Deposits a valid Egg NFT into the vault
Calls withdrawEgg, triggering the transfer
Malicious onERC721Received callback re-enters withdrawEgg before _removeDeposit executes
Repeats until vault is drained
Theft of all deposited Egg NFTs from the vault.
Tools Used
Manual review.
Add Reentrancy Guard
Use OpenZeppelin's ReentrancyGuard:
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.