Hi,
I have found out some potential bugs which can lead to multiple inconsistencies in the smart contract EggHuntGame.sol.
The key details of the potential vulnerabilities in the code can be given as follows:
Insecure Randomness:
In function searchForEgg, it uses block.timestamp and block.prevrandao, which leads to predictable results and helps to increase their chances of finding an egg.
Lack of Access Control:
eggCounter is not directly modifiable by users but it's value tied to NFT minting eggNFT.mintEgg. AsEggstravaganzaNFT doesn't validate tokenId uniqueness, attacker can exploit it to mint duplicate/invalid NFTs.
Insecure Randomness:
Attacker could predict the random number to increase their chances of finding an egg.
Lack of Access Control:
Attacker can mint unlimited NFTs and makes the DoS scenario for other users.
Manual Review + VS Code
Insecure Randomness:
Use Chainlink VRF, ensure tamper-proof randomness.
Lack of Access Control:
Enforce unique tokenId values and prevents unauthorized minting + make the function private.
Insecure methods to generate pseudo-random numbers
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.