The EggVault
contract's depositEgg
function lacks proper access controls, allowing anyone to register themselves as the depositor of an NFT that has been transferred to the vault but not yet properly registered. This enables front-running attacks where malicious actors can steal NFTs by claiming ownership of assets they never owned.
In the current implementation, the depositEgg
function in EggVault
can be called by any address to register a depositor for an NFT:
The function only checks that:
The NFT is currently owned by the vault
The NFT hasn't already been registered as deposited
It does not verify any relationship between the caller and the NFT, nor does it restrict who can call the function. This creates a vulnerability when users follow a two-step deposit process where they first transfer the NFT to the vault and then register themselves as the depositor.
This vulnerability allows malicious users to steal NFTs by front-running legitimate depositors. The attack scenario occurs when:
A legitimate user transfers their NFT to the vault
Before they can register the deposit, an attacker calls depositEgg and registers themselves as the depositor
The attacker can then withdraw the NFT, gaining ownership of an asset they never rightfully owned
This attack is particularly likely in several common scenarios:
When users encounter transaction failures where their transfer succeeds but registration fails
When users interact directly with the contracts instead of through a proper UI
When users don't understand the need to complete both steps of the deposit process
The vulnerability represents a direct risk of asset theft for users of the platform.
Manual code review
Foundry for creating and running the proof of concept test
Implement onERC721Received to automatically register deposits upon NFT transfer
or
Option 2: Add Access Control to depositEgg
or
Option 3: Create an Atomic Deposit Function
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.