MorpheusAI

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

GatewayRouterMock::outboundTransfer lack of address check could lead to token stuck forever

Summary

GatewayRouterMock::outboundTransfer lack of address check could lead to token stuck forever if address(this) is used on _to parameter because there is no way to transfer out tokens in this contract

Vulnerability Details

If address(this) ie address(GatewayRouterMock) is used on to parameter there is no way to transfer out tokens in this contract

contract GatewayRouterMock {
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); // TOKENS ARE TRANSFERED TO THIS
return abi.encode(_token, _to, _amount, _maxGas, _gasPriceBid, _data);
}

But there is no way to transfer out

Impact

Tokens stuck in contract

Tools Used

Manual review

Recommendations

Implement a check to prevent sending tokens to this contract

contract GatewayRouterMock {
function outboundTransfer(
address _token,
address _to,
uint256 _amount,
uint256 _maxGas,
uint256 _gasPriceBid,
bytes calldata _data
) external payable returns (bytes memory) {
require(_to != address(this), " invalid _to");
IERC20(_token).transferFrom(msg.sender, _to, _amount); // TOKENS ARE TRANSFERED TO THIS
return abi.encode(_token, _to, _amount, _maxGas, _gasPriceBid, _data);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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