The WeatherNft contract contains critical flaws in its NFT minting workflow:
Unauthorized Minting: The fulfillMintRequest function allows any address to mint NFTs using publicly exposed request IDs, bypassing payment and access controls.
Duplication Vulnerability: Missing replay protection enables unlimited NFT minting for the same request ID.
Incorrect Recipient Assignment: NFTs are minted to msg.sender instead of the original requester.
fulfillMintRequestLocation:
Issue:
The function is external and lacks modifiers (e.g., onlyFunctionsRouter), allowing arbitrary addresses to trigger NFT minting.
Impact: Attackers can mint NFTs without paying or participating in the minting process.
Location:
Issue:
The contract ignores the stored user address (_userMintRequest.user) and mints to msg.sender.
Impact: Attackers call fulfillMintRequest with stolen request IDs from legitimate users to mint NFTs.
Location:
Issue:
The contract does not track whether a requestId has already been used for minting.
Impact: A single request ID can mint unlimited NFTs, corrupting the token counter and supply.
Location:
Issue:
Emitting requestId in public events allows attackers to harvest valid IDs for exploitation.
Likelihood:
Trivial. Attackers can easily extract requestId from public blockchain events.
Any Ethereum address can call fulfillMintRequest with a valid requestId
Common in contracts that decouple request initiation from fulfillment without access control.
Front-running or replaying transactions using publicly visible data.
Impact:
NFT ownership records become unreliable, devaluing the entire collection.
Attackers could resell stolen NFTs or exploit the bug repeatedly.
Legitimate User Action:
Alice’s requestMintWeatherNFT transaction is broadcasted.
Attacker Action:
Bob detects Alice’s transaction, extracts the requestId, and call fulfillMintRequest function.
Result:
NFT is minted for Bob using Alice’s requestId.
Enforce Access Control in fulfillMintRequest
Prevent RequestId Reuse
Add a mapping(bytes32 => bool) public s_processedRequests; to track used requestIds.
Invalidate requestId immediately after processing:
There is no check to ensure that the caller of the `fulfillMintRequest` function is actually the owner of the `requestId`. This allows a malicious user to receive a NFT that is payed from someone else.
The `WeatherNFT::fulfillMintRequest` allows a malicious user to call multiple times the function with the same `requestId`.
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.