code-423n4 / 2022-06-putty-findings

5 stars 0 forks source link

CALL() SHOULD BE USED INSTEAD OF TRANSFER() ON AN ADDRESS PAYABLE #3

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Lines of code

https://github.com/code-423n4/2022-06-putty/blob/main/contracts/src/PuttyV2.sol#L336

Vulnerability details

Vulnerability details

Impact

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

Proof of Concept

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.

Recommended Mitigation Steps

I recommend using call() instead of transfer().

berndartmueller commented 2 years ago

IWETH(weth).transfer(order.maker, msg.value); on L336 is an ERC-20 token transfer, not a native ETH transfer.

outdoteth commented 2 years ago

confirming what @berndartmueller said