Use call() instead of transfer() when transferring ETH
Summary
call() should be used instead of transfer() on an address payable.
Vulnerability Detail
The transfer() and send() functions forward a fixed amount of 2300 gas. Historically, it has often been recommended to use these functions for value transfers to guard against reentrancy attacks. However, the gas cost of EVM instructions may change significantly during hard forks which may break already deployed contract systems that make fixed assumptions about gas costs.
tsvetanovv
medium
Use
call()
instead oftransfer()
when transferring ETHSummary
call()
should be used instead of transfer() on an address payable.Vulnerability Detail
The transfer() and send() functions forward a fixed amount of 2300 gas. Historically, it has often been recommended to use these functions for value transfers to guard against reentrancy attacks. However, the gas cost of EVM instructions may change significantly during hard forks which may break already deployed contract systems that make fixed assumptions about gas costs.
Impact
See Vulnerability Detail
Code Snippet
https://github.com/sherlock-audit/2023-03-sense/blob/main/sense-v1/pkg/core/src/Periphery.sol#L1008-L1014
https://github.com/sherlock-audit/2023-03-sense/blob/main/auto-roller/src/RollerPeriphery.sol#L111
Tool used
Manual Review
Recommendation
I recommend using
call()
method instead oftransfer()
.Duplicate of #33