In EggstravaganzaNFT.sol the onlyOwner can set their address as the gameContract. Which is then used to mint eggNFT, and if approved the onlyOwner can then mint themselves the eggNFT
In EggstravaganzaNFT.sol in the setGameContract function it takes a parameter of _gameContract and of type address. Which then is set to gameContract. Then it's used in the mintEgg function as a require check, which if passed then you can mint the eggNFT to the address that is passed in the parameter. The problem is that the address
that is minted to should be the gameContract and the address of the gameContract should be the EggHuntGame.sol, this is all inputted by the onlyOwner. The problem is onlyOwner is a trusted user, but they could act in bad faith and set the address of the gameContract to their own. And then in mintEgg function they can set their wallet address in the parameter. This will allow them to mint themselves the eggNFT. This can happen because in the mintEgg function there's a require statement that states require(msg.sender == gameContract, "Unauthorized minter");. This passes since the onlyOwner set the gameContract address to their own and msg.sender has to be the address of the gameContract, which the address of msg.sender is the address of onlyOwner since onlyOwner is the one that called the function.
onlyOwner can mint themselves the eggNFT and take it all if they decided to act in bad faith.
Manual Review
Use this code instead
This prevents unauthorized address even the contract owner from minting and only allows the game contract to mint the NFT.
Owner is trusted and is not expected to interact in ways that would compromise security
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.