The collectFee() function is designed to withdraw all accumulated WETH and native ETH fees from the contract and send them to the s_collector address. The developer intended for this to be an atomic operation.
The problem is that the WETH transfer and the ETH transfer are improperly bundled. The function first transfers WETH and then uses a low-level .call() to send ETH. If the s_collector is a contract that cannot receive ETH (e.g., it lacks a receive() function or its function reverts), the .call() will fail. This failure triggers the require() statement, which reverts the entire transaction. As a result, the initial successful WETH transfer is also rolled back, making it impossible to collect the WETH and effectively locking the funds.
Likelihood:
This vulnerability occurs when the s_collector address is set to a smart contract that does not implement a payable fallback() or receive() function.
This also occurs when the s_collector is a contract whose receive() function reverts for any reason, such as failing an internal requirement, running out of gas, or being intentionally malicious.
Impact:
Denial of Service (DoS): The collectFee() function becomes unusable. No fees of any kind can be withdrawn from the contract.
Permanent Loss of Funds: All WETH held by the contract becomes permanently frozen and irrecoverable, as the only function designed to withdraw it is bricked. The same applies to the native ETH.
The following test demonstrates the vulnerability. A MaliciousCollector contract is set as the fee collector. This contract is designed to reject any incoming native ETH. When collectFee() is called, the transaction reverts.
Separate the collection logic into two distinct functions. This isolates the failure of one asset transfer from the other, preventing a DoS vector and ensuring that at least one type of asset can always be collected.
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.