Skip to content
Business logic Audit finding Intermediate

cBridge integration fails to send native tokens

The cBridge integration in the Li.Fi smart contract failed to send native tokens along with the external call, so bridging native tokens would revert. An attacker could not exploit this directly, but users would be unable to bridge native tokens through cBridge.

hickuphh3 Follow

Originally disclosed on Code4rena

Submitted by hickuphh3, also found by hyh, rayn, shw, WatchPug, and wuwe1

CBridgeFacet.sol#L150-L156

The external sendNative() call fails to include sending the native tokens together with it.

Proof of Concept

Add the following test case to the CBridgeFacet test file.

// TODO: update bridge address to 0x5427FEFA711Eff984124bFBB1AB6fbf5E3DA1820
it.only('reverts because ETH not sent to bridge', async () => {
  CBridgeData.token = constants.AddressZero
  CBridgeData.amount = constants.One
  await expect(lifi.connect(alice).startBridgeTokensViaCBridge(lifiData, CBridgeData, {
    value: constants.One,
    gasLimit: 500000
  })).to.be.revertedWith('Amount mismatch');
})

Recommended Mitigation Steps

ICBridge(bridge).sendNative{ value: _cBridgeData.amount }(
  _cBridgeData.receiver,
  _cBridgeData.amount,
  _cBridgeData.dstChainId,
  _cBridgeData.nonce,
  _cBridgeData.maxSlippage
);

In addition, add the payable keyword to the CBridge interface.

H3xept (Li.Fi) resolved and commented:

Fixed in lifinance/lifi-contracts@b684627b57c4891bee13fcfcfcf2595965843cc6

gzeon (judge) commented:

Valid POC. Sponsor confirmed with fix.


The original report as published on Code4rena, by hickuphh3. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

Users could not bridge native tokens via cBridge because the transaction would revert; no direct loss of funds is described.

What the attacker needed

User attempts to bridge native tokens via cBridge

The fix

The contract was fixed by attaching the native token amount to the sendNative call and marking the interface function as payable.

How it was found

  1. Set the bridge token to the zero address and amount to one.
  2. Call startBridgeTokensViaCBridge with a value of one and a gas limit.
  3. Observe the transaction reverts with 'Amount mismatch'.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This is a bug in a smart contract that helps users move tokens between blockchains. When a user tried to send the blockchain's native currency (like ETH) through this bridge, the contract called the bridge but forgot to actually attach the money to the call, so the transaction failed. It's like writing a cheque but not signing it.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by hickuphh3

View all

43 more disclosed reports, best first.

More from LI.FI contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.