The EggVault::depositEgg
function has no checking system for a depositor, allowing anyone to call this function without ensuring that the depositor
is the rightful owner of the tokenId
.
Proof of Concept:
Mint egg to vault
Attacker calls EggVault::depositEgg
and the function will think that this is a valid depositor
Attacker calls EggVault::withdrawEgg
, freely withdraw his stolen NFT from the vault.
Proof of Code:
Add the following code to the EggHuntGameTest.t.sol
file.
Attackers can withdraw other people's NFTs
Original depositor cannot withdraw his NFT
Foundry
To prevent this problem, we should add an NFT ownership check before assigning a depositor
.
Front-running depositEgg allows deposit ownership hijacking.
Front-running depositEgg allows deposit ownership hijacking.
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.