A malicious user can input their own address and the tokenId
of someone else's Eggstravaganza NFT in the depositEgg
function. Then when they call the withdrawEgg
function they will pass the require check since they are both the msg.sender
and depositor
, allowing them to transfer anyone's Eggstravaganza NFT to their own wallet.
In EggVault.sol
the function depositEgg
takes in a parameter tokenId
of type unit256 and a parameter depositor
of type address. The problem is that anyone can put their own address in as the depositor
and input the tokenId
of someone else's Eggstravaganza NFT. Then this records the tokenId
to the address of depositor
. Then in the function withdrawEgg
you can input the same tokenId
and since now that the tokenId
is set to the depositor
, it'll just have a require statement to check and see if the msg.sender
is the depositor
. Which is true since the malicious user input their own address as the depositor
and they are the one calling the withdrawEgg
function. Which will then allow them to transfer the Eggstravaganza NFT from the EggVault.sol
contract to their wallet.
Anyone can input the tokenId
of someone else's Eggstravaganza NFT and take owner ship of the NFT over them and withdraw the token from the vault to their wallet.
Manual Review
In the depositEgg
function remove the parameter for depositor
of type address and include this code instead.
This way we first check to see if the owner of the NFT is the msg.sender
and if yes then we transfer the NFT from msg.sender
to address(this)
which is the EggVault.sol
contract.
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.