The WeatherNft::fulfillMintRequest
function allows any external address to call it with a known requestId
, and mints the Weather NFT to the caller (msg.sender
). This enables an attacker to front-run the legitimate user’s mint request and steal the NFT, even after the user has paid the mint price and initiated the request.
Mint Hijack / NFT Theft
Anyone can listen for the WeatherNFTMintRequestSent
event, obtain the requestId
, and call fulfillMintRequest
before the legitimate user.
The NFT will be minted to the attacker's address, even though the original user paid for it.
Likelihood:
An attacker can monitor the blockchain for WeatherNFTMintRequestSent
events and, as soon as a valid requestId
is emitted, immediately call fulfillMintRequest
with that ID.
This is likely to happen for every mint, since the event and requestId
are public and easily accessible to any motivated attacker.
Impact:
The attacker receives the NFT, even though the legitimate user paid for it, causing loss of funds and NFTs for users.
Legitimate users may be unable to successfully mint NFTs, resulting in denial of service for all new mints as attackers front-run every mint request.
This PoC demonstrates an attacker can steal the minted NFT by calling fulfillMintRequest
with a legitimate user's requestId
before the user does. The NFT is minted to the attacker's address.
A legitimate user initiates a mint request by calling requestMintWeatherNFT
, paying the required mint price and emitting a WeatherNFTMintRequestSent
event with the associated requestId
.
The attacker monitors the blockchain for WeatherNFTMintRequestSent
events, extracting the requestId
before the legitimate user completes the process.
The Chainlink oracle fulfillment is simulated, making the mint ready for completion.
Before the original user can call fulfillMintRequest
, the attacker quickly calls this function with the known requestId
.
Because there is no authorization check on fulfillMintRequest
, the NFT is minted directly to the attacker's address, even though the legitimate user paid the minting fee.
Manual Review
Foundry Unit Testing
Add Authorization Check
Only the original requester should be allowed to call fulfillMintRequest
:
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 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.