VaderReserve does not support paying IL protection out to more than one address, resulting in locked funds
VaderReserve only allows a single router to claim IL protection, so if both VaderRouter and VaderRouterV2 are deployed, liquidity providers using the non-whitelisted router cannot remove liquidity because the call to the reserve reverts. This could permanently lock all liquidity in one of the pools.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
Impact
All liquidity deployed to one of VaderPool or VaderPoolV2 will be locked permanently.
Proof of Concept
Both VaderRouter and VaderRouterV2 make calls to VaderReserve in order to pay out IL protection.
- https://github.com/code-423n4/2021-11-vader/blob/3a43059e33d549f03b021d6b417b7eeba66cf62e/contracts/dex/router/VaderRouter.sol#L206
- https://github.com/code-423n4/2021-11-vader/blob/3a43059e33d549f03b021d6b417b7eeba66cf62e/contracts/dex-v2/router/VaderRouterV2.sol#L227
However VaderReserve only allows a single router to claim IL protection on behalf of users.
It’s unlikely that the intent is to deploy multiple reserves so there’s no way for both VaderRouter and VaderRouterV2 to pay out IL protection simultaneously.
This is a high severity issue as any LPs which are using the router which is not listed on VaderReserve will be unable to remove liquidity as the call to the reserve will revert. Vader governance is unable to update the allowed router on VaderReserve so all liquidity on either VaderPool or VaderPoolV2 will be locked permanently.
Recommended Mitigation Steps
Options:
- Allow the reserve to whitelist multiple addresses to claim funds
- Allow the call to the reserve to fail without reverting the entire transaction (probably want to make this optional for LPs)
As the code indicates, only one of the two versioned instances of the AMM will be deployed and active at any given time rendering this exhibit incorrect.
Sorry @SamSteinGG, where does the code indicate that?
Correction, this was clarified during the audit in the discord channel.
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 reserve contract hard-codes a single authorised router address instead of allowing multiple routers to be whitelisted.
Impact
All liquidity deployed to one of VaderPool or VaderPoolV2 could be locked permanently if both routers are deployed, though the project disputed that both would be active.
What the attacker needed
Both VaderRouter and VaderRouterV2 deployed; liquidity provided via the non-whitelisted router
The fix
The reserve should allow multiple addresses to claim funds, or the call to the reserve should be allowed to fail without reverting the entire transaction.
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 this system, a 'reserve' contract holds funds for 'impermanent loss protection' (a kind of refund for liquidity providers). The reserve only trusts one router contract to request payouts. If two routers exist, the one not trusted cannot get payouts, and any attempt to remove liquidity through it fails, trapping users' funds.
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.