use of transfer() instead of call() to send eth
The smart contracts use Solidity's transfer() to send ETH, which forwards a fixed 2300 gas stipend. After the Istanbul hardfork increased SLOAD gas costs, some recipient contracts with fallback functions that consume more than 2300 gas would fail to receive ETH, potentially making funds impossible to withdraw.
Submitted by JMukesh.
Impact
Use of transfer() might render ETH impossible to withdraw because after istanbul hardfork, there is an increase in the gas cost of the SLOAD operation and therefore breaks some existing smart contracts.Those contracts will break because their fallback functions used to consume less than 2300 gas, and they’ll now consume more, since 2300 the amount of gas a contract’s fallback function receives if it’s called via Solidity’s transfer() or send() methods. Any smart contract that uses transfer() or send() is taking a hard dependency on gas costs by forwarding a fixed amount of gas: 2300.
- https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/
- https://blog.openzeppelin.com/opyn-gamma-protocol-audit/
Proof of Concept
- https://github.com/sushiswap/miso/blob/2cdb1486a55ded55c81898b7be8811cb68cfda9e/contracts/MISOTokenFactory.sol#L242
- https://github.com/sushiswap/miso/blob/2cdb1486a55ded55c81898b7be8811cb68cfda9e/contracts/MISOMarket.sol#L256
- https://github.com/sushiswap/miso/blob/2cdb1486a55ded55c81898b7be8811cb68cfda9e/contracts/MISOLauncher.sol#L251
- https://github.com/sushiswap/miso/blob/2cdb1486a55ded55c81898b7be8811cb68cfda9e/contracts/MISOFarmFactory.sol#L244
Tools Used
manual review
Recommended Mitigation Steps
use call() to send eth
maxsam4 (Sushi Miso) disputed and commented:
This is intentional, not a risk. The contract does not want to give any gas stipend to the destination.
Even if the user messes up,
misoDevaddress can be changed to a proper address later.
using
.transfercan make ETH transfer to a smart contract impossible. User can always change the address however I agree with warden that this is an issue.
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 use of transfer() instead of call() for sending ETH, which hardcodes a 2300 gas stipend that may be insufficient for recipient fallback functions after gas cost changes.
Impact
ETH transfers to smart contracts with fallback functions that require more than 2300 gas could fail, potentially making funds impossible to withdraw, though the recipient address can be changed later.
What the attacker needed
Recipient is a contract with costly fallback
The fix
The recommendation is to use call() instead of transfer() to send ETH, but the project disputed this as intentional and no fix was confirmed.
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 to another contract, it can specify how much processing power (gas) the recipient gets to run its code. The transfer() function gives a fixed, small amount of gas (2300). If the recipient's code needs more than that, the transfer fails and the Ether cannot be sent. This report says that after a network upgrade, some contracts need more gas, so using transfer() could block payments.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.