This report identifies critical vulnerabilities in the EggHunt game ecosystem, including insecure pseudo-random number generation, insufficient access control, and reentrancy risks. The system’s current implementation exposes users to potential exploitation, such as unfair NFT minting and unauthorized vault operations.
Location: EggHuntGame.sol
→ searchForEgg()
Description:
The searchForEgg()
function generates pseudo-randomness using block.timestamp
and block.prevrandao
, which are predictable values. Attackers can precompute favorable conditions to guarantee successful egg minting.
Attack Scenario:
A malicious contract calls searchForEgg()
multiple times in a single transaction, exploiting the same block variables to manipulate outcomes.
Expected success rate becomes significantly higher than the defined eggFindThreshold
(e.g., 20%).
payload
Location: EggVault.sol
→ depositEgg()
Description:
The depositEgg()
function lacks validation to ensure only the game contract can trigger it. Any address can spoof deposits, allowing fake NFTs to be stored in the vault.
Attack Scenario:
An attacker deploys a malicious contract to call depositEgg()
with arbitrary token IDs, corrupting vault records.
payload
Location: EggVault.sol
→ withdrawEgg()
Description:
Although the function follows checks-effects-interactions, the lack of reentrancy guards exposes it to risks if external dependencies are modified.
Vulnerability | Potential Consequences |
---|---|
Predictable randomness | Unfair NFT distribution; game economy manipulation. |
Unauthorized vault deposits | Fake NFTs stored in the vault; loss of user trust. |
Reentrancy risks | Funds/NFTs stolen if future upgrades introduce external calls. |
Manual Code Review
Foundry
Replace Insecure RNG:
Use Chainlink VRF for verifiable randomness.
Short-term workaround: Implement a commit-reveal scheme.
Enforce Access Control:
Restrict depositEgg()
to the game contract.
Validate NFT Approvals:
Add Reentrancy Guards:
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.