Submitted by leastwood
The emergencyWithdraw function is implemented in all yield sources to allow the onlyOwner role to drain the contracts balance in case of emergency. The contract considers ETH as a zero address asset. However, there is a call made on _asset which will revert if it is the zero address. As a result, ETH tokens can never be withdrawn from the NoYield contract in the event of an emergency.
Consider the case where _asset == address(0). An external call is made to check the contracts token balance for the target _asset. However, this call will revert as _asset is the zero address. As a result, the onlyOwner role will never be able to withdraw ETH tokens during an emergency.
Affected function as per below:
https://github.com/code-423n4/2021-12-sublime/blob/main/contracts/yield/NoYield.sol#L78-L83
Consider handling the case where _asset is the zero address, i.e. the asset to be withdrawn under emergency is the ETH token.
ritik99 (Sublime) confirmed
0xean (judge) commented:
