The EggstravaganzaNFT
contract assigns minting authority to a single gameContract
address without validating its behavior. This creates an insecure trust boundary that allows a malicious contract to be assigned and used to arbitrarily mint NFTs.
The contract uses a single variable, gameContract
, to determine whether a caller is authorized to mint:
The gameContract
address is set by the owner via:
There is no validation that the assigned contract adheres to a specific interface, behaves as expected, or is not malicious. As a result, any attacker who gains access to the owner account — or any mistakenly trusted contract — can be granted minting power.
In our test, we deployed a malicious contract that exposes a public function allowing arbitrary minting. Once this contract is set as gameContract
, anyone can mint NFTs by calling it.
[PASS] test_MaliciousContractCanMintIfWhitelisted() (gas: 376139)
Logs:
Total supply before attack: 0
Malicious game contract deployed at: 0x2561e2FAEA20b514433C253266d9DA5dDD3E4Cd5
Victim address: 0x000000000000000000000000000000000000bEEF
Egg owner of tokenId 999: 0x000000000000000000000000000000000000bEEF
Total supply after attack: 1
Unauthorized NFTs can be minted by untrusted or malicious contracts.
Total supply can be inflated arbitrarily.
Trust assumptions around the uniqueness and fairness of the game are broken.
If NFTs have market value or gameplay significance, this could enable theft, spam, or manipulation.
Foundry
Console logging (via console.log
)
Manual inspection and test-based Proof of Code
Require the gameContract
to implement a known interface (e.g., IGameMinter
) and enforce it via try/catch
or interface checks.
Consider restricting minting to a known, immutable game contract — or use access control patterns from OpenZeppelin like AccessControl
.
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.