Skip to content
Business logic Audit finding Intermediate

Router liquidity on receiving chain can be double-dipped by the user

During cross-chain fulfilment, if a user's contract at the callTo address causes both addFunds and execute to revert, the fallback transfer to the receiving address happens twice, letting the user receive double the intended amount and draining router liquidity.

0xRajeev Follow

Originally disclosed on Code4rena

Submitted by 0xRajeev, also found by cmichel, gpersoon, pauliax, s1m0 and shw

During fulfill() on the receiving chain, if the user has set up an external contract at txData.callTo, the catch blocks for both IFulfillHelper.addFunds() and IFulfillHelper.excute() perform transferAsset to the predetermined fallback address txData.receivingAddress.

If addFunds() has reverted earlier, toSend amount would already have been transferred to the receivingAddress. If execute() also fails, it is again transferred.

Scenario: User sets up receiver chain txData.callTo contract such that both addFunds() and execute() calls revert. That will let him get twice the toSend amount credited to the receivingAddress. So effectively, Alice locks 100 tokenAs on chain A, and can get 200 tokenAs (or twice the amount of any token she is supposed to get on chain B from the router), minus relayer fee, on chain B. Router liquidity is double-dipped by Alice and router loses funds. See TransactionManager.sol L395-L409 and L413-L428.

Recommend that the second catch block for execute() should likely not have the transferAsset() call. It seems like a copy-and-paste bug unless there is some reason that is outside the specified scope and documentation for this contest.

LayneHaber (Connext) confirmed and patched:

https://github.com/connext/nxtp/pull/39

The original report as published on Code4rena, by 0xRajeev. 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

Root cause

Likely a copy-and-paste error: the catch block for execute() also calls transferAsset(), duplicating the fallback transfer already performed in the catch block for addFunds().

Impact

The user could receive double the intended token amount on the receiving chain, and the router loses the extra funds.

What the attacker needed

Ability to deploy a contract on the receiving chain; initiate a cross-chain transfer

The fix

The second catch block for execute() should not call transferAsset(); the issue was confirmed and patched.

How it was found

  1. Set up a contract at txData.callTo on the receiving chain that causes both addFunds() and execute() to revert.
  2. Initiate a cross-chain transfer so that fulfil() is called on the receiving chain.
  3. The catch block for addFunds() transfers the toSend amount to the receivingAddress.
  4. The catch block for execute() transfers the same amount again to the receivingAddress.
  5. The user receives twice the intended amount, and the router loses liquidity.

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.

A bridge moves tokens between two blockchains. When tokens arrive on the second chain, the bridge tries to call a helper contract the user specified. If that call fails, the bridge sends the tokens to a fallback address. The bug is that if two different helper calls both fail, the bridge sends the tokens twice, so the user gets double the tokens and the bridge loses money.

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 0xRajeev

View all

61 more disclosed reports, best first.

More from Connext Amarok 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.