It calls _checkAdapterParams to validate gas, chainId and package
(amount,) = _removeDust(_amount); ensures there is no dust on receiving chain while converting between long and short decimals
While,
function lockTwTapPosition(
address to,
uint256 amount, // Amount to add
uint256 duration, // Duration of the position.
uint16 lzDstChainId,
address zroPaymentAddress,
bytes calldata adapterParams
) external payable {
bytes memory lzPayload = abi.encode(
PT_LOCK_TWTAP, // packet type
msg.sender,
to,
amount,
duration
);
require(duration > 0, "TapOFT: Small duration");
bytes32 senderBytes = LzLib.addressToBytes32(msg.sender);
_debitFrom(msg.sender, lzEndpoint.getChainId(), senderBytes, amount);
_lzSend(
lzDstChainId,
lzPayload,
payable(msg.sender),
zroPaymentAddress,
adapterParams,
msg.value
);
emit SendToChain(
lzDstChainId,
msg.sender,
LzLib.addressToBytes32(to),
0
);
}
does not have those checks, Since user can pass these params as input, it can lead to bad decimal conversion if dst chain is SD chain and gas greifing / DOS on relayer of tapioca because of no checks on adapter params.
Lines of code
https://github.com/Tapioca-DAO/tap-token-audit/blob/59749be5bc2286f0bdbf59d7ddc258ddafd49a9f/contracts/tokens/BaseTapOFT.sol#L88
Vulnerability details
Impact
In OFTCoreV2 (provided as example by LayerZero)
_checkAdapterParams
to validate gas, chainId and package(amount,) = _removeDust(_amount);
ensures there is no dust on receiving chain while converting between long and short decimalsWhile,
does not have those checks, Since user can pass these params as input, it can lead to bad decimal conversion if dst chain is SD chain and gas greifing / DOS on relayer of tapioca because of no checks on adapter params.
Proof of Concept
N/A (covered in above section)
Tools Used
Manual
Recommended Mitigation Steps
Assessed type
Invalid Validation