The changeFeeAddress function (line 195) allows the contract owner to update the address that receives protocol fees. However, the function lacks a validation check to ensure the newFeeAddress is not address(0).
In Solidity version 0.7.6, performing a .call{value: ...}("") to address(0) does not revert; it returns success = true. Consequently, if the admin accidentally sets the fee address to zero, the withdrawFees function will execute successfully, but all accumulated protocol fees will be sent to the burn address, resulting in the permanent loss of those funds.
Likelihood:
Low. This vulnerability requires a manual administrative error (the owner providing the wrong input). However, since there is no way to "un-burn" funds once they are sent to address(0), the lack of a safety check is a significant oversight.
Impact:
High. The impact is the permanent destruction of protocol revenue. Once withdrawFees is called with a zero-address set:
The totalFees counter is reset to 0.
The ETH is transferred to address(0).
The protocol owner loses 100% of the accumulated fees for that period with no possibility of recovery.
The test demonstrates that the owner can successfully set the feeAddress to address(0). When the raffle concludes and fees are withdrawn, the transaction succeeds, the contract's totalFees state is cleared, but the ETH is sent to the zero address instead of a wallet controlled by the protocol.
Add a require statement in the changeFeeAddress function to prevent setting the address to address(0). Additionally, consider emitting an event for better off-chain tracking.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.