Swaps done internally will be not be possible
The internal swap path in the bridge contract passed the wrong arguments to the internal swap function, so the token ownership check could never pass. As a result, swaps that relied on an internal pool would always fail rather than execute.
Submitted by 0xmint
BridgeFacet.sol#L346 BridgeFacet.sol#L812
Vulnerability details
Affected functions(that rely on swapAsset()) are:
swapAsset() facilitates two swaps, either using the internal or external pool. But if an internal pool exists, a swap will be unsuccessful because the call to
s.swapStorages[_canonicalId].swapInternal() takes two incorrect arguments (due to an incorrect ordering, this seemed to be an oversight, acknowledged by #Layne) :
Based on the above mentioned code , the arguments would be incorrectly changed to :
The condition checked here:
will never be true as the msg.sender would never own the quantity of tokens being swapped from since it’s the wrong token.
jakekidd (Connext) confirmed and resolved:
Resolved by connext/nxtp@a66844e
0xleastwood (judge) commented:
Great find!
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 the arguments passed to the internal swap function were in the wrong order, so the ownership check compared against the wrong token.
Impact
Swaps routed through an internal pool would always fail, so that functionality was effectively broken; the text does not describe any theft or loss of funds.
What the attacker needed
An internal pool exists for the token
The fix
The issue was fixed by a commit in the project repository, according to the maintainer's comment.
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 smart contract is a program on a blockchain. This one had a function for swapping tokens using an internal pool, but it handed the wrong values to the swap routine. The check that the caller owns the tokens being swapped therefore always failed, so the swap simply could not go through.
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.