MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: low
Invalid

Missing check of returned value by `transfer` and `transferFrom` functions

Summary

Multiple calls to transferFromand transfer are done without checking the results.

Vulnerability Details

In WStETHMOCK::wrap, GatewayRouterMock::outboundTransfer and SwapRouterMock::exactInputSingle are used functions transfer or transferFrom, but their returned values are not checked.

`WStETHMOCK::wrap`:
function wrap(uint256 stETHAmount_) external returns (uint256) {
require(stETHAmount_ > 0, "wstETH: can't wrap zero stETH");
_mint(msg.sender, stETHAmount_);
stETH.transferFrom(msg.sender, address(this), stETHAmount_);
return stETHAmount_;
}
`GatewayRouterMock::outboundTransfer`:
function outboundTransfer(
address _token,
address _to,
uint256 _amount,
uint256 _maxGas,
uint256 _gasPriceBid,
bytes calldata _data
) external payable returns (bytes memory) {
IERC20(_token).transferFrom(msg.sender, _to, _amount);
return abi.encode(_token, _to, _amount, _maxGas, _gasPriceBid, _data);
}
`SwapRouterMock::exactInputSingle`:
function exactInputSingle(ISwapRouter.ExactInputSingleParams calldata params_) external returns (uint256) {
IERC20(params_.tokenIn).transferFrom(msg.sender, address(this), params_.amountIn);
IERC20(params_.tokenOut).transfer(params_.recipient, params_.amountIn);
return params_.amountIn;
}

Impact

If the values returned by the transfer and transferFrom functions are not checked, they are taken as true. They can not revert but return false value. Therefore, it is important to check the returned value.

Tools Used

Manual Review

Recommendations

It is necessary to add processing of the values returned by the described functions or use safeTransfer/safeTransferFrom.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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