code-423n4 / 2022-12-escher-findings

0 stars 0 forks source link

call() should be used instead of transfer() on an address payable #182

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2022-12-escher/blob/5d8be6aa0e8634fdb2f328b99076b0d05fefab73/src/minters/FixedPrice.sol#L109 https://github.com/code-423n4/2022-12-escher/blob/5d8be6aa0e8634fdb2f328b99076b0d05fefab73/src/minters/LPDA.sol#L85 https://github.com/code-423n4/2022-12-escher/blob/5d8be6aa0e8634fdb2f328b99076b0d05fefab73/src/minters/OpenEdition.sol#L92

Vulnerability details

Impact

call() should be used instead of transfer() on an address payable

Proof of Concept

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. For example. EIP 1884 broke several existing smart contracts due to a cost increase of the SLOAD instruction.

The use of the deprecated transfer() function for an address will inevitably make the transaction fail when:

Tool used

Manual Review

Recommended Mitigation Steps

Use call() instead of transfer(), but be sure to respect the CEI pattern and/or add re-entrancy guards, as several hacks already happened in the past due to this recommendation not being fully understood.

More info at https://swcregistry.io/docs/SWC-134

c4-judge commented 1 year ago

berndartmueller marked the issue as duplicate of #99

c4-judge commented 1 year ago

berndartmueller marked the issue as satisfactory