Paying IL protection for all VaderPool pairs allows the reserve to be drained.
The Vader protocol paid impermanent loss protection for all liquidity pairs, including those the attacker could create cheaply. An attacker could create a pool with a worthless token they control, manipulate its price to appear to have suffered large impermanent loss, and then claim VADER tokens from the reserve, draining it.
Originally disclosed on Code4rena
Submitted by TomFrenchBlockchain
Impact
Vader Reserve can be drained of funds.
Proof of Concept
In VaderPoolV2.burn we calculate the current losses that the LP has made to impermanent loss.
These losses are then refunded to the LP in VADER tokens from the reserve. NOTE: This IL protection is paid for ALL token pairs. THIS IS IMPORTANT!
The loss is calculated by the comparing the amounts of each asset initially added to the pool against the amounts of each asset which are removed from the pool. There’s an unspoken assumption here that the LP entered the pool at the true price at that point.
Crucially we see that if an attacker can cheaply create a pool with a token which starts off with a very low price in terms of VADER and is guaranteed to have a very high price in terms of VADER then they will benefit from a large amount of IL protection funds from the reserve.
An attacker could then perform this attack with the following.
- Flashloan a huge amount of Vader (or flashloan + buy VADER).
- Deploy a token TKN, which the attacker can mint as much as they like.
- Add liquidity to a new pool with a large amount of VADER and a small amount of TKN
- Use their ability to mint TKN to buy up all the VADER in their pool
- Repay flashloan with VADER extracted from pool + some pre-existing funds as attacker needs to cover VADER lost to swap fees/slippage.
The attacker has now engineered a liquidity position which looks massively underwater due to IL but in reality was very cheap to produce. Nobody else can do anything to this pool except just give the attacker money by buying TKN so this attack can’t be prevented. The attacker now just needs to wait for at most a year for the IL protection to tick up and then they can cash in the LP position for a nice payday of up to the amount of VADER they initially added to the pool.
Recommended Mitigation Steps
Add a whitelist to the pairs which qualify for IL protection.
Predicting the price fluctuations of an asset is impossible. An attacker cannot create a pool arbitrarily as that is governed by a special whitelist function that is in turn voted on by the DAO.
As we saw in other issues, the creation of pools is permissionless
@alcueca Again, there seems to be confusion as to the versions utilized. The submitter references the Vader V2 implementation in which pool creations are indeed permissioned (via the add supported token function) as the Vader pool factory is only relevant to the V1 implementation.
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 impermanent loss protection was applied to all pools without restricting which tokens could be paired, allowing an attacker to create a pool with a token they control and manipulate its price to claim excessive protection.
Impact
The Vader Reserve could be drained of funds, but the protocol team disputed the attack's feasibility, claiming pool creation is permissioned and price prediction is impossible.
What the attacker needed
Ability to flashloan VADER; ability to deploy a token contract; permissionless pool creation (disputed)
The fix
Add a whitelist to the pairs which qualify for IL protection.
How it was found
- Flashloan a huge amount of Vader (or flashloan + buy VADER).
- Deploy a token TKN, which the attacker can mint as much as they like.
- Add liquidity to a new pool with a large amount of VADER and a small amount of TKN
- Use their ability to mint TKN to buy up all the VADER in their pool
- Repay flashloan with VADER extracted from pool + some pre-existing funds as attacker needs to cover VADER lost to swap fees/slippage.
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.
Impermanent loss is when the value of assets you put into a liquidity pool changes compared to just holding them. The protocol promised to refund that loss using its reserve of VADER tokens. The bug is that this refund was available for any token pair, so an attacker could make a fake token, create a pool, and trick the system into paying out a large refund.
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.