DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: medium
Invalid

Calls transfer()/transferFrom() With IERC20

Calls transfer()/transferFrom() With IERC20

  • Severity: Medium

  • Confidence: High

Description

The transfer() and transferFrom() methods are part of the ERC-20 standard, designed for transferring tokens between accounts. However, these methods could be risky when transferring tokens to smart contracts because they don't guarantee that the receiving smart contract will handle the transferred tokens correctly, potentially leading to permanent token loss. ERC-20 standard doesn't include a 'onTokenReceived' function or similar to alert the recipient about incoming transfers. Therefore, the 'transfer' and 'transferFrom' functions are not reliable for interactions with arbitrary contracts. A safer alternative is to use safeTransfer() and safeTransferFrom() methods provided by libraries like OpenZeppelin's SafeERC20. These methods add a layer of protection by checking if the recipient is a contract and if it has a function to handle incoming tokens. If these checks are not passed, the transfer operation is not executed, hence preventing potential token loss.

There are 4 instances of this issue:

File: contracts/bridges/BridgeReth.sol
64 rocketETHToken.transferFrom(from, address(this), amount)

use safeTransferFrom instead.

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/bridges/BridgeReth.sol#L64

File: contracts/bridges/BridgeReth.sol
94 rocketETHToken.transfer(to, rethValue)

use safeTransferFrom instead.

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/bridges/BridgeReth.sol#L94

File: contracts/bridges/BridgeSteth.sol
66 steth.transferFrom(from, address(this), amount)

use safeTransferFrom instead.

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/bridges/BridgeSteth.sol#L66

File: contracts/bridges/BridgeSteth.sol
87 steth.transfer(to, amount)

use safeTransferFrom instead.

https://github.com/Cyfrin/2023-09-ditto/blob/main/contracts/bridges/BridgeSteth.sol#L87

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.