This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
bin2chen - mTOFTReceiver MSG_XCHAIN_LEND_XCHAIN_LOCK unable to execute #63
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
bin2chen
medium
mTOFTReceiver MSG_XCHAIN_LEND_XCHAIN_LOCK unable to execute
Summary
In
mTOFTReceiver._toftCustomComposeReceiver(uint16 _msgType)
If
_msgType
is processed normally, the method must returntrue
, if it returnsfalse
, it will triggerrevert InvalidMsgType()
But when
_msgType == MSG_XCHAIN_LEND_XCHAIN_LOCK
is executed normally, it does not correctly return trueThis causes this type of execution to always fail
Vulnerability Detail
The main execution order of
_lzCompose()
is as follows:_remoteTransferReceiver()
_extExec(msgType_, tapComposeMsg_)
tapiocaOmnichainReceiveExtender
_toeComposeReceiver()
_toeComposeReceiver()
returns false, it is considered that the type cannot be found, andrevert InvalidMsgType(msgType_);
is triggeredthe code as follows:
The implementation of
mTOFTReceiver._toeComposeReceiver()
is as follows:As mentioned above, because
_msgType == MSG_XCHAIN_LEND_XCHAIN_LOCK
does not returntrue
, it always triggersrevert InvalidMsgType(msgType_);
Impact
_msgType == MSG_XCHAIN_LEND_XCHAIN_LOCK
TOFTOptionsReceiver.mintLendXChainSGLXChainLockAndParticipateReceiver()
unable to execute successfullyCode Snippet
https://github.com/sherlock-audit/2024-02-tapioca/blob/main/TapiocaZ/contracts/tOFT/modules/mTOFTReceiver.sol#L36-L43
Tool used
Manual Review
Recommendation
contract mTOFTReceiver is BaseTOFTReceiver { constructor(TOFTInitStruct memory _data) BaseTOFTReceiver(_data) {} function _toftCustomComposeReceiver(uint16 _msgType, address, bytes memory _toeComposeMsg) internal override returns (bool success) { if (_msgType == MSG_LEVERAGE_UP) { //@check _executeModule( uint8(ITOFT.Module.TOFTMarketReceiver), abi.encodeWithSelector(TOFTMarketReceiverModule.leverageUpReceiver.selector, _toeComposeMsg), false ); return true; } else if (_msgType == MSG_XCHAIN_LEND_XCHAIN_LOCK) { //@check _executeModule( uint8(ITOFT.Module.TOFTOptionsReceiver), abi.encodeWithSelector( TOFTOptionsReceiverModule.mintLendXChainSGLXChainLockAndParticipateReceiver.selector, _toeComposeMsg ), false ); + return true; } else { return false; } } }
The text was updated successfully, but these errors were encountered: