Anyone can arbitrarily add router liquidity
The addLiquidity function allows anyone to add liquidity on behalf of a router by transferring ERC20 tokens from the router's address, assuming the router has approved the contract. This could arbitrarily increase the router's exposure to protocol risk without authorization.
Submitted by 0xRajeev, also found by cmichel and pauliax
The addLiquidity() function takes a router address parameter, whose liquidity is increased (instead of assuming that router == msg.sender like is done on removeLiquidity()) on this contract/chain, by transferring the fund amount from router address to this contract if assetID != 0 (i.e. ERC20 tokens). However, anyone can call this function on the router’s behalf. For assetID == 0, the Ether transfer via msg.value comes from msg.sender and hence is assumed to be the router itself.
The impact is that this will allow anyone to call this function and arbitrarily move ERC20 tokens from router address to this contract, assuming router has given max approval to this contract and has assetID amount available for transfer. While the router can always remove the liquidity if it doesn’t want to maintain that level of liquidity, this lack of access control or flexibility for a relayer to add liquidity on router’s behalf, may unnecessarily (and without authorization) increase the router’s exposure to protocol risk to more than it desires. See TransactionManager.sol #L88-L98. See also, use of msg.sender in removeLiquidity (#L88-L98).
Recommend considering the use of msg.sender in addLiquidity() or evaluate this risk otherwise.
LayneHaber (Connext) acknowledged:
The bigger issue here is the typo here, if we use the funds from
msg.senderthat means that people are donating funds to the router.We will fix the
msg.sender, but allowaddLiquidityto be callable by anyone
This is high risk because funds can be send to the wrong address.
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 addLiquidity function lacks access control and uses a router address parameter instead of msg.sender, allowing anyone to act on behalf of the router.
Impact
This could allow anyone to arbitrarily move ERC20 tokens from a router's address to the contract, increasing the router's exposure to protocol risk without authorization.
What the attacker needed
Router has given max approval to contract; router has sufficient assetID balance
The fix
The team will fix the use of msg.sender but still allow addLiquidity to be callable by anyone.
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.
In a smart contract, a function that adds liquidity (funds) should only be callable by the router itself. Here, anyone can call it and move tokens from the router's account, which could force the router to take on more risk than it wants.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.