When the EggVault
contract is deployed, the owner must set the address of the NFT contract whose NFTs can be deposited into the vault. The owner does this using the EggVault::setEggNft
function, which can be called as many times as the owner desires.
A malicious owner could exploit this after several players have deposited their NFT Eggs into the vault. By calling EggVault::setEggNft
, the owner can change the NFT contract address. As a result, the transferFrom
function in EggVault::withdrawEgg
would no longer interact with the original NFT contract where the players’ NFTs are stored, preventing players from withdrawing their deposited NFT Eggs.
A player who deposits their Eggs into the vault could find themselves in a situation where the owner changes the NFT contract address, rendering them unable to withdraw their NFTs.
VS code: Cloned the repository locally and identified the vulnerability through manual review.
The address of the EggVault::eggNFT
contract could be defined in the constructor and marked as immutable
to prevent it from being changed. This would ensure players can trust that, if the address is correct at deployment, they won’t end up in a situation where they cannot withdraw their NFT Eggs. Function EggVault::setEggNft
can be removed then.
Owner is trusted and is not expected to interact in ways that would compromise security
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.