All vulnerabilities
CRITICALWeb3exploited in the wild

WEB3-LIFI-2022

Web3 · Multichain · LI.FI (CBridgeFacet)

Summary

On 20 March 2022 the LI.FI swap/bridge router was exploited for about $596,000 from 29 wallets that had granted token approvals to its CBridgeFacet contract. The swapAndStartBridgeTokensViaCBridge path let callers supply an array of swaps each carrying an arbitrary destination address and arbitrary calldata, which the contract executed with a low-level call() under its own context and with no target allowlist or selector check. The attacker passed a tiny legitimate swap followed by calls whose target was an ERC-20 token and whose calldata was transferFrom(victim, attacker, amount). Because victims had given infinite approval to CBridgeFacet, those transferFrom calls succeeded, draining their wallets directly. This is the arbitrary-external-call / untrusted call-target router bug that weaponizes user approvals.

How to avoid it in your code

  • Never let users pass an arbitrary target+calldata to an internal call() that runs with the contract's approvals
  • Allowlist call targets and the exact selectors (DEX routers/swap functions only); reject ERC-20 transferFrom/approve selectors
  • Pull funds via transferFrom into the router first, then operate on contract-owned balances, not the caller's approvals
  • Avoid infinite approvals to router facets; scope approvals per-swap and revoke, and validate that destination tokens match

References

Related vulnerabilities

All Web3 →