Router Owner Could Be Rugged By Admin #150
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/RoutersFacet.sol#L293
https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/RoutersFacet.sol#L490
https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/RoutersFacet.sol#L212
Vulnerability details
Proof-of-Concept
Assume that Alice's router has large amount of liquidity inside.
Assume that the Connext Admin decided to remove a router owned by Alice. The Connext Admin will call the
RoutersFacet.removeRouter
function, and all information related to Alice's router will be erased (set to 0x0) from thes.routerPermissionInfo
.https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/RoutersFacet.sol#L293
Alice is aware that her router has been removed by Connext Admin, so she decided to withdraw the liquidity from her previous router by calling
RoutersFacet.removeRouterLiquidityFor
.However, when Alice called the
RoutersFacet.removeRouterLiquidityFor
function, it will revert every single time. This is because the conditionmsg.sender != getRouterOwner(_router)
will always fail.https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/RoutersFacet.sol#L490
Since the
RoutersFacet.removeRouter
function has earlier erased all information related to Alice's router withins.routerPermissionInfo
, thegetRouterOwner
function will always return the router address.In this case, the router address will not match against
msg.sender
address/Alice address, thus Alice attempts to callremoveRouterLiquidityFor
will always revert.https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/RoutersFacet.sol#L212
Impact
Router owner who provides liquidity could be rugged by Connext admin. When this happen, the router owner funds will be struck within the
RoutersFacet
contract, and there is no way for the router owner to retrieve their liquidity.In the worst case scenario, a compromised Connext admin could remove all routers, and cause all liquidity to be struck within
RoutersFacet
and no router owner could withdraw their liquidity from the contract. Next, theRouterFacet
contract could be upgraded to include additional function to withdraw all liquidity from the contract to an arbitrary wallet address.Recommended Mitigation Steps
The router owner is still entitled to their own liquidity even though their router has been removed by Connext Admin. Thus, they should be given the right to take back their liquidity when such an event happens. The contract should update its implementation to support this. This will give more assurance to the router owner.
The text was updated successfully, but these errors were encountered: