The RAACNFT contract allows users to mint NFTs by depositing ERC-20 tokens. However, the contract does not include a function to withdraw Ether that may have been mistakenly sent to it, leading to potential loss of funds.
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/tokens/RAACNFT.sol
The contract does not have a payable function or a mechanism to withdraw mistakenly sent Ether. Since smart contracts can receive Ether through direct transfers (e.g., selfdestruct or send operations from other contracts), any Ether sent to this contract would become permanently locked, as there is no function to recover it.
Key Observations:
The contract does not have a receive() or fallback() function to handle Ether transactions.
There is no withdraw() function to allow the owner to retrieve any locked Ether.
If Ether is mistakenly sent to the contract, it will be irretrievable, leading to a potential financial loss.
Loss of Ether sent to the contract by mistake.
Increased risk for users interacting with the contract, as they may accidentally send Ether and be unable to recover it.
Manual code review
To prevent locked Ether, implement the following:
Reject Incoming Ether: Explicitly prevent Ether from being sent to the contract by adding a receive() function that reverts.
Withdraw Function for Owner: Allow the contract owner to recover any Ether accidentally sent.
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.