Loss of ETH for proposer when it is a contract that doesn’t have fallback function.
The contract's ETH transfer helper falls back to sending WETH if a direct ETH transfer fails, which can happen when the recipient is a contract without a fallback function or with insufficient gas. An attacker or unlucky proposer could have their ETH converted to WETH and stuck in a contract that cannot handle WETH, causing a loss of funds.
Submitted by Trust
sendEthOrWeth() is used in several locations in OptimisticListingSeaport:
- rejectProposal - sent to proposer
- rejectActive - sent to proposer
- cash - sent to msg.sender
This is the implementation of sendEthOrWeth:
function _attemptETHTransfer(address _to, uint256 _value) internal returns (bool success) {
// Here increase the gas limit a reasonable amount above the default, and try
// to send ETH to the recipient.
// NOTE: This might allow the recipient to attempt a limited reentrancy attack.
(success, ) = _to.call{value: _value, gas: 30000}("");
}
/// @notice Sends eth or weth to an address
/// @param _to Address to send to
/// @param _value Amount to send
function _sendEthOrWeth(address _to, uint256 _value) internal {
if (!_attemptETHTransfer(_to, _value)) {
WETH(WETH_ADDRESS).deposit{value: _value}();
WETH(WETH_ADDRESS).transfer(_to, _value);
}
}
The issue is that the receive could be a contract that does not have a fallback function. In this scenario, _attemptETHTransfer will fail and WETH would be transferred to the contract. It is likely that it bricks those funds for the contract as there is no reason it would support interaction with WETH tokens.
It can be reasonably assumed that developers will develop contracts which will interact with OptimisticListingSeaport using proposals. They are not warned and are likely to suffer losses.
Impact
Loss of ETH for proposer when it is a contract that doesn’t have fallback function.
Recommended Mitigation Steps
Either enforce that proposer is an EOA or take in a recipient address for ETH transfers.
The argument here is about the contract being able to handle ETH but not WETH. If the ETH transfer fails (eg. gas used exceeds the 30k sent), then funds would be stuck.
On the fence regarding severity here.
stevennevins (Tessera) confirmed, but disagreed with severity and commented:
I actually more agree with this being an issue:
The argument here is about the contract being able to handle ETH but not WETH. If the ETH transfer fails (eg. gas used exceeds the 30k sent), then funds would be stuck.
But it’s not clear to me that is what was originally highlighted in the description of the issue.
Yeah it’s not fully clear because the premise is the contract not having a fallback function, but the intended effect of not being able to handle WETH is.
It is likely that it bricks those funds for the contract as there is no reason it would support interaction with WETH tokens.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the fallback mechanism assumes the recipient can handle WETH when ETH transfer fails, without checking if the recipient is a contract that supports WETH.
What the attacker needed
Proposer is a contract without fallback; or ETH transfer fails due to gas
The fix
The contract should either enforce that the proposer is an externally owned account (EOA) or allow specifying a separate recipient address for ETH transfers.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a smart contract sends Ether (ETH) to another contract, the receiving contract must have a special function to accept it; otherwise the transfer fails. This code tries to send ETH, and if that fails, it sends a different token (WETH) instead. But the receiving contract might not be able to handle WETH either, so the funds get stuck.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.