The EggVault::depositEgg
function can be frontrun claiming an user NFT and then it can be sent to the attacker wallet using the EggVault::withdrawEgg
function.
The way to deposit a NFT into EggVault
is this:
UserA
approves the EggHuntGame
contract to transfer the NFT.
The EggHuntGame::depositEggToVault
function transfer the NFT to EggVault
.
The owner of the NFT is now EggVault
.
Then the EggVault::depositEgg
function is called to officially tell the EggVault
that the NFT belongs to UserA
.
This is very risky because the transaction can be seen in the mempool so, an attacker can call the EggHuntGame::depositEggToVault
before the real owner, providing the attacker address and claim ownership of the NFT.
As we can see, in order to claim ownership of the NFT an address of the depositor is required and this address can be any address. So anyone can call this function by pretending to be the owner.
Ability to steal all NFTs that users send to the EggVault
.
Manual Review
Foundry
Remove functionality of sending the NFTs from the EggHuntGame
to the EggVault
. It is not useful and brings more risks than benefits.
If a user wants to deposit his NFT, he should only do it directly calling the Vault.
Remove this function from EggHuntGame
Modify this function in EggVault
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.