call() should be used instead of transfer() on an address payable
The smart contracts use the deprecated transfer() function to send Ether, which forwards only 2300 gas. If the recipient is a contract that needs more gas (e.g., a multisig wallet or a proxy), the transfer will fail, potentially locking funds or breaking functionality.
Submitted by Dravee, also found by antonttc, berndartmueller, cccz, danb, horsefacts, hyh, IllIllI, MaratCerby, pauliax, rayn, UnusualTurtle, WatchPug, and wuwe1
This is a classic Code4rena issue:
- https://github.com/code-423n4/2021-04-meebits-findings/issues/2
- https://github.com/code-423n4/2021-10-tally-findings/issues/20
- https://github.com/code-423n4/2022-01-openleverage-findings/issues/75
Impact
The use of the deprecated transfer() function for an address will inevitably make the transaction fail when:
- The claimer smart contract does not implement a payable function.
- The claimer smart contract does implement a payable fallback which uses more than 2300 gas unit.
- The claimer smart contract implements a payable fallback function that needs less than 2300 gas units but is called through proxy, raising the call’s gas usage above 2300.
Additionally, using higher than 2300 gas might be mandatory for some multisig wallets.
Impacted lines:
backd/contracts/pool/EthPool.sol:
30: to.transfer(amount);
backd/contracts/strategies/BkdEthCvx.sol:
77: payable(vault).transfer(amount);
93: payable(vault).transfer(amount);
117: payable(vault).transfer(underlyingBalance);
backd/contracts/vault/EthVault.sol:
29: payable(to).transfer(amount);
37: payable(addressProvider.getTreasury()).transfer(amount);
backd/contracts/vault/VaultReserve.sol:
81: payable(msg.sender).transfer(amount);
Recommended Mitigation
I recommend using call() instead of transfer().
chase-manning (Backd) confirmed and resolved
Sponsor confirmed. Judging this as Medium Risk.
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 the deprecated transfer() method, which forwards a fixed 2300 gas stipend, instead of call() which allows specifying gas.
Impact
Transactions sending Ether could fail if the recipient contract requires more than 2300 gas, potentially causing loss of funds or denial of service.
What the attacker needed
Recipient is a contract needing >2300 gas; or recipient is a proxy; or recipient is a multisig wallet
The fix
The fix is to replace transfer() with call() and handle the return value, as the sponsor confirmed and resolved.
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 using transfer(), it only gives the recipient a tiny fixed amount of gas (2300). If the recipient is another contract that needs to do more work (like a multisig wallet), the transfer fails. This report says the code should use call() instead, which lets the recipient use more gas.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.