DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: low
Invalid

Unchecked Transfer Vulnerability in `init` Function of `ReseedL2Migration` Contract

Summary

The init function in the ReseedL2Migration contract unconditionally transfers ERC-20 tokens to a specified address without verifying the success of these transfers. This can lead to potential vulnerabilities and undesirable behaviors if any of the token transfers fail. Ensuring the success of these transfers is critical to maintain the integrity and reliability of the contract's operations.

Vulnerability Details

See the following code:

function init() external {
// Pause beanstalk, preventing future sunrises.
s.paused = true;
s.pausedAt = uint128(block.timestamp);
emit Pause(block.timestamp);
// transfer the following whitelisted silo assets to the BCM:
// bean:eth
IERC20 beanEth = IERC20(C.BEAN_ETH_WELL);
uint256 beanEthBalance = beanEth.balanceOf(address(this));
beanEth.transfer(BCM, beanEthBalance);
// BEAN:WstETH
IERC20 beanwsteth = IERC20(C.BEAN_WSTETH_WELL);
uint256 beanwstethBalance = beanwsteth.balanceOf(address(this));
beanwsteth.transfer(BCM, beanwstethBalance);
// BEAN:3CRV
IERC20 bean3crv = IERC20(C.CURVE_BEAN_METAPOOL);
uint256 bean3crvBalance = bean3crv.balanceOf(address(this));
bean3crv.transfer(BCM, bean3crvBalance);
}

In the init function, several ERC-20 tokens are transferred to the BCM (Beanstalk Community Multisig) address. However, the function does not check the return value of the transfer calls, which can indicate whether the transfer was successful. According to the ERC-20 standard, the transfer function returns a boolean value indicating the success or failure of the operation. Ignoring this return value can lead to the following issues:

  • If any of the transfers fail, the function will proceed as if the transfer was successful, leading to incorrect assumptions about the contract's state.

  • Subsequent operations that rely on the successful transfer of funds might be executed under false pretenses, potentially leading to loss or misallocation of assets.

Impact

The contract might incorrectly assume that the funds have been transferred when they have not. This can lead to inconsistencies in the contract's state and subsequent operations that depend on these transfers. If the contract proceeds with other operations assuming the transfer was successful, it might result in financial losses or misallocation of assets. The functionality that depends on these transfers might malfunction, causing disruptions in the protocol's operations.

Tools Used

Manual Review

Recommendations

To mitigate these issues, it is crucial to verify the success of each transfer operation by checking the return value of the transfer function. If any transfer fails, the function should revert to prevent further execution.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational/Gas

Invalid as per docs https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity

Support

FAQs

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