Should prevent users from sending more native tokens in the startBridgeTokensViaCBridge function
The CBridgeFacet contract accepted more native tokens than the specified bridge amount, leaving the excess in the contract. An attacker could recover these stranded tokens, causing a loss of funds for the user who overpaid.
Submitted by shw, also found by hickuphh3, hyh, Picodes, and pmerkleplant
When a user bridges a native token via the startBridgeTokensViaCBridge function of CBridgeFacet, the contract checks whether msg.value >= _cBridgeData.amount holds. In other words, if a user accidentally sends more native tokens than he has to, the contract accepts it but only bridges the _cBridgeData.amount amount of tokens. The rest of the tokens are left in the contract and can be recovered by anyone (see another submission for details).
Notice that in the similar functions of other facets (e.g., AnyswapFacet, HopFacet), the provided native token is ensured to be the exact bridged amount, which effectively prevents the above scenario of loss of funds.
Proof of Concept
Recommended Mitigation Steps
Consider changing >= to == at line 68.
Fixed by lifinance/lifi-contracts@bb21af9a30ea73393101fc80efaa3a1f7cf25bd1
Sponsor confirmed with fix.
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
Root cause
The contract used a greater-than-or-equal check instead of an exact equality check on the sent value, allowing excess native tokens to remain in the contract.
Impact
Excess native tokens sent by a user could be recovered by anyone, resulting in a loss of funds for that user.
What the attacker needed
User sends more native tokens than needed
The fix
The check was changed from >= to ==, and the sponsor confirmed the fix.
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.
When you send cryptocurrency to a smart contract, you might send more than needed by mistake. This contract only used the exact amount for bridging and kept the extra, which anyone could later take. The fix makes the contract reject any extra amount.
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.