The WeatherNFT
contract accepts funds via the payable function requestMintWeatherNFT
. However, there is no withdraw functionality for accumulated funds resulting in them being locked permanently in the contract.
To mint a Weather NFT, a user is required to call the payable function, WeatherNft:requestMintWeatherNFT
with an amount equal to the current minting price.
Overtime, with more users minting, the WeatherNFT
contract will accumulate funds.
However, the contract has no function to withdraw the funds in the contract resulting in funds being permanently locked in the contract and can not be used by the owner/protocol for any future ventures and/or profit.
Review of existing external/public functions
Below is a list of all external and public functions in the contract
requestMintWeatherNFT
fulfillMintRequest
checkUpkeep
performUpkeep
updateFunctionsGasLimit
updateSubId
updateMinimumLinkDeposit
updateSource
updateEncryptedSecretsURL
updateKeeperGaslimit
tokenURI
None of the above contracts have any logic related to withdrawing the funds in the contract.
Any internal functions linked with above mentioned external/public functions, also have no logic related to withdrawals.
This is High Severity issue due to:
High Impact: There are lost funds for the protocol
The funds within the contract can not be used to collect profit for the protocol. Furthermore, the locked funds cannot be used to fund any future developments to improve the protocol.
High Likelihood: This issue will occur every time a user mints request to mint an NFT.
There are no complications or additional requirements meaning each time, a user pays to have an NFT minted, the contract will have the balance of the locked funds incremented.
To prove the validity of the issue a manual walkthrough is provided.
Minting price is at 0.5 ether. User A calls requestMintWeatherNFT
with 0.5 ether to pay for minting.
3 more users pay to have a WeatherNFT. (each paying slightly more than the previous user)
The Protocol/Owner tries to withdraw the funds but cannot because there is no withdraw functionality.
Code
While the issue may suffice from a manual walkthrough, I have provided a test case than is compatible with the current test suite. It simply shows the contract balance exists when user mints an NFT. These funds will be permanently locked in WeatherNFT
.
The recommended mitigation to solve this issue is to add a withdraw method that can only be called by the owner.
I have provided a function template that can be added to the contract.
It can only be called by the Owner
It requires the contract balance to be greater than 0
The contract collects funds for minting a WeatherNFT, but there is no function that allows the owner to withdraw these funds.
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.