The requestMintWeatherNFT
function in the WeatherNft contract contains a reentrancy vulnerability where the mint price is increased after the external call to IERC20, potentially allowing an attacker to exploit this sequence to mint multiple NFTs at a lower price.
In the requestMintWeatherNFT
function, the contract updates the mint price after making an external call:
This occurs after the external call to transfer funds, which could potentially allow a reentrancy attack. The function should follow the checks-effects-interactions pattern, updating state variables before making external calls.
This PoC demonstrates how an attacker could exploit the reentrancy vulnerability to mint multiple NFTs at the original price, bypassing the price increase mechanism.
This vulnerability could allow an attacker to:
Mint multiple NFTs at the original price instead of the increased price
Manipulate the minting process to gain an unfair advantage
Potentially drain funds from the contract through repeated exploitation
The impact is high as it directly affects the economic model of the NFT system and could lead to financial losses.
Implement the checks-effects-interactions pattern by moving the price increase before any external calls:
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.