The EggVault
contract contains a significant vulnerability in its design: the contract owner can change the NFT contract address via the setEggNFT
function at any time without adequate safeguards. This functionality creates a critical risk where previously deposited NFTs could become permanently locked in the vault if the NFT contract reference is altered. Users who have deposited assets would be unable to withdraw their NFTs as the contract would attempt to interact with a different NFT contract than the one their tokens reside in.
The vulnerable function is found in the EggVault
contract:
This function allows the owner to change the reference to the EggstravaganzaNFT contract at any time. The issue stems from the fact that:
There is no initialization check to prevent changing the address after deposits have been made
No migration mechanism exists to handle existing deposits when changing the contract address
The withdrawal function relies on the current NFT address reference:
If the NFT contract address is changed after users have already deposited NFTs, those NFTs would remain in the old contract while the withdrawal function would attempt to call transferFrom
on the new contract. This would fail, permanently locking user assets in the vault.
Permanent Asset Loss: Users' NFTs could become permanently locked in the vault if the NFT contract address is changed.
Trust Violation: Users deposit assets with the expectation of being able to withdraw them later, but this mechanism can be broken unilaterally by the owner.
Manual Review
Immutable NFT Contract Reference: Make the NFT contract reference immutable by setting it only in the constructor:
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.