#38363 [SC-Medium] LBTC cross-chain transfer can be DOSed
Submitted on Jan 1st 2025 at 15:16:53 UTC by @jasonxiale for Audit Comp | Lombard
Report ID: #38363
Report Type: Smart Contract
Report severity: Medium
Target: https://github.com/lombard-finance/evm-smart-contracts/blob/main/contracts/bridge/adapters/TokenPool.sol
Impacts:
Temporary freezing of funds for at least 30 days
Description
Brief/Intro
While transferring LBTC cross chains using CCIP, LombardTokenPool.releaseOrMint will be called on the dest chain. While EVM2EVMOffRamp._releaseOrMintToken calls LombardTokenPool.releaseOrMint to mint LBTC for the recipient, the function LombardTokenPool.releaseOrMint's parameter releaseOrMintIn includes the token's information
37 struct ReleaseOrMintInV1 {
38 bytes originalSender; // The original sender of the tx on the source chain
39 uint64 remoteChainSelector; // ─╮ The chain ID of the source chain
40 address receiver; // ───────────╯ The recipient of the tokens on the destination chain.
41 uint256 amount; // The amount of tokens to release or mint, denominated in the source token's decimals
42 address localToken; // The address on this chain of the token to release or mint
43 /// @dev WARNING: sourcePoolAddress should be checked prior to any processing of funds. Make sure it matches the
44 /// expected pool address for the given remoteChainSelector.
45 bytes sourcePoolAddress; // The address of the source pool, abi encoded in the case of EVM chains
46 bytes sourcePoolData; // The data received from the source pool to process the release or mint
47 /// @dev WARNING: offchainTokenData is untrusted data.
48 bytes offchainTokenData; // The offchain data to process the release or mint
49 }As above code shows, there are a few import things:
receiveraddress andamountare included directly in the parameter
40 address receiver; // ───────────╯ The recipient of the tokens on the destination chain.
41 uint256 amount; // The amount of tokens to release or mint, denominated in the source token's decimals
offchainTokenDatais untrusted data, which means it isn't verified by CCIP's i_commitStore
47 /// @dev WARNING: offchainTokenData is untrusted data.
48 bytes offchainTokenData; // The offchain data to process the release or mint
And in LombardTokenPool.releaseOrMint, the function doesn't verify recipient info stored in releaseOrMintIn.offchainTokenData matches releaseOrMintIn.receiver and releaseOrMintIn.amount.
So an attacker can abuse the mismatch to block other users' cross-chain LBTC transfer.
Vulnerability Details
As shown in TokenPool.releaseOrMint, the function doesn't use the recipient info included in releaseOrMintIn, and also doesn't verify if the releaseOrMintIn.offchainTokenData matches the recipient info stored in releaseOrMintIn
Then in Bridge.authNotary, $.consortium.checkProof can only make sure the payload is signed by correct validators.
And also in EVM2EVMOffRamp._execute, while cross-chain messages are verified, the report.offchainTokenData isn't verified.
Impact Details
Please consider the following case:
Alice send a cross-chain tx to transfer 10e8 LBTC from ETH to BNB
Bob wants to block Alice's tx on BNB chain, so he send a cross-chain tx to transfer 1 unit LBTC.(Please note this step isn't necessary, Bob can use other's tx as well).
Both Alice and Bob's tx will be signed by Consortium's validators.
If everything goes well, EVM2EVMOffRamp.manuallyExecute will be called with:
And after the EVM2EVMMessage been executed, the message will be marked as
Internal.MessageExecutionState.SUCCESSin EVM2EVMOffRamp.sol#L411Because Bob wants to block Alice's tx on BNB chain, he will front-run the
EVM2EVMOffRamp.manuallyExecutewith message_alice plus payload_bob as parameters. In such case, because TokenPool.releaseOrMint handles LBTC transfer based onreleaseOrMintIn.offchainTokenData, which means Bob's payload will be executed. But because CCIP marks the executed message based onmessage.sequenceNumber,message_alicewill be marked as executedWhen Alice executes her tx, because her
message.sequenceNumberis marked as executed, her LBTC can't be transferred.
References
Add any relevant links to documentation or code
Proof of Concept
Proof of Concept
Please put the following code in test/Bridge.ts and run
As the POC demostrates, the amount of token trasferred based on payload, instead of releaseOrMintIn.amount
Last updated
Was this helpful?