The owner of the contract EggstravaganzaNFT
has the ability to mint Eggs without entering a game. Even though the owner wouldn't be a participant or winner of the game, if the eggs are tradable on an NFT platform for real money, the owner could abuse the protocol.
Using function EggstravaganzaNFT::setGameContract
owner of the contract EggstravaganzaNFT
can manipulate state variable with function EggstravaganzaNFT::gameContract
in a way to put own address. Then owner can call EggstravaganzaNFT::mintEgg
and mint Eggs.
Owner calls EggstravaganzaNFT::setGameContract
with own address
Owner can mint NFT Egg using EggstravaganzaNFT::mintEgg
Place following into the EggHuntGameTest.t.sol
Owner will get NFT Eggs without playing the game, and if NFT Eggs have real value players would be in unfair situation.
Vs Code: Cloned the repository locally and identified the vulnerability through manual review.
A simple solution is to introduce a boolean variable EggstravaganzaNFT::gameContractSet
that is responsible for preventing changes to the EggstravaganzaNFT::gameContract
variable after its first initialization. This way, the EggstravaganzaNFT
contract remains tied to the game, and its owner cannot manipulate the minting of Eggs. Below are the necessary changes to the EggstravaganzaNFT
contract.
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.