The EggVault contract contains a critical access control vulnerability that allows hacker to steal nft owned by EggVault
. This vulnerability stems from improper access control in the depositEgg
function, which doesn't verify the caller's authorization to deposit the NFT.
The vulnerability exists in the EggVault
contract's depositEgg
function. The function accepts two parameters:
tokenId
: The ID of the NFT to be deposited
depositor
: The address of the depositor
The critical issue is that the depositEgg
function is marked as public
and doesn't verify if the caller is authorized to deposit the NFT. This allows any user to:
Call depositEgg
with token ID(owned by EggVault
and hasn't deposited in EggVault
) and depositor address
Mark themselves as the depositor of an NFT they don't own
Subsequently withdraw the NFT using the withdrawEgg
function
High Severity: This vulnerability allows any user to steal NFTs from the vault
Financial Impact: Direct loss of NFT assets
Reputation Damage: Loss of trust in the platform's security
The vulnerability can be demonstrated with the following test case:
Foundry
To fix this vulnerability, implement the following changes:
Add access control to the depositEgg
function, like only EggGame can call this 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.