Skip to content
Business logic Audit finding Intermediate

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.

TomFrenchBlockchain Follow

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.

However VaderReserve only allows a single router to claim IL protection on behalf of users.

https://github.com/code-423n4/2021-11-vader/blob/3a43059e33d549f03b021d6b417b7eeba66cf62e/contracts/reserve/VaderReserve.sol#L80-L83

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:

  1. Allow the reserve to whitelist multiple addresses to claim funds
  2. Allow the call to the reserve to fail without reverting the entire transaction (probably want to make this optional for LPs)

SamSteinGG (Vader) disputed:

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.

alcueca (judge) commented:

Sorry @SamSteinGG, where does the code indicate that?

SamSteinGG (Vader) commented:

Correction, this was clarified during the audit in the discord channel.

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

More by TomFrenchBlockchain

View all

28 more disclosed reports, best first.

More from Vader Protocol 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.