The withdraw function in the contract allows the host to withdraw ERC20 tokens from the contract, but it fails to provide a way for Ether (ETH) sent to the contract to be withdrawn. This leaves any ETH deposited in the contract "locked", as there is no handling for it in the original function. The proposed fix adds the ability for the host to withdraw ETH using the .call method.
Root Cause: The original withdraw function only supports the withdrawal of ERC20 tokens (WETH, WBTC, USDC) and does not include a mechanism to withdraw Ether (ETH) sent to the contract. As a result, any Ether sent to the contract is stuck in the contract and cannot be withdrawn.
Expected Behavior: The contract should allow the host to withdraw both ERC20 tokens and Ether (ETH) sent to the contract.
Current Behavior: The contract only handles the withdrawal of ERC20 tokens. Ether (ETH) sent to the contract is "trapped" and cannot be retrieved by the host.
The failure to allow withdrawal of Ether sent to the contract results in funds being locked in the contract. If the contract is used in a way that Ether is deposited into it, the absence of this feature could create financial risks or prevent proper management of funds.
Manual code review.
Foundry for testing
1 - Implement Ether Withdrawal: Modify the withdraw function to support the withdrawal of Ether. This can be done using the .call method, which is a more secure way to transfer Ether compared to .transfer due to its gas limitations.
Security Considerations: Ensure the use of .call{value: amount}("") to handle Ether transfers, as it avoids gas stipend limitations present in .transfer and gives the receiver more flexibility. Adding a revert() with a message on failure ensures that the failure reason is clear.
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.