Skip to content
Business logic Audit finding Advanced

Vault rewards can be gamed

The vault's member weight was calculated from the swap output of a deposited synth, and anyone could create a synth for a custom token. An attacker could deposit a valueless custom synth with an artificially high price to inflate their weight and claim most vault rewards.

Vader Protocol contest

Originally disclosed on Code4rena

The _deposit function increases the member’s weight by _weight = iUTILS(UTILS()).calcValueInBase(iSYNTH(_synth).TOKEN(), _amount); which is the swap output amount when trading the deposited underlying synth amount.

Notice that anyone can create synths of custom tokens by calling Pools.deploySynth(customToken).

Therefore an attacker can deposit valueless custom tokens and inflate their member weight as follows:

  1. Create a custom token and issue lots of tokens to the attacker
  2. Create synth of this token
  3. Add liquidity for the TOKEN <> BASE pair by providing a single wei of TOKEN and 10^18 BASE tokens. This makes the TOKEN price very expensive.
  4. Mint some synths by paying BASE to the pool
  5. Deposit the fake synth, _weight will be very high because the token pool price is so high.

Call harvest(realSynth) with a synth with actual value. This will increase the synth balance and it can be withdrawn later.

Anyone can inflate their member weight through depositing a custom synth and earn almost all vault rewards by calling harvest(realSynth) with a valuable “real” synth. The rewards are distributed pro rata to the member weight which is independent of the actual synth deposited.

The calcReward function completely disregards the synth parameter which seems odd. Recommend thinking about making the rewards based on the actual synths deposited instead of a “global” weight tracker. Alternatively, whitelist certain synths that count toward the weight, or don’t let anyone create synths.

strictly-scarce (vader) confirmed:

This is a valid attack path.

The counter is two fold:

  1. In the vault, require(isCurated(token)) this will only allow synths of curated tokens to be deposited for rewards. The curation logic does a check for liquidity depth, so only deep pools can become synths. Thus an attacker would need to deposit a lot of BASE.
  2. In the vaults, use _weight = iUTILS(UTILS()).calcSwapValueInBase(iSYNTH(_synth).TOKEN(), _amount);, which computes the weight with respect to slip, so a small manipulated pool cannot be eligible. The pool would need to be deep.

The Vault converts all synths back to common accounting asset - USDV, so member weight can be tracked.

strictly-scarce (vader) commented: Disagree with severity, since the daily rewards can be claimed by anyone in a fee-bidding war but no actual extra inflation occurs.

Severity: 2

The original report as published on Code4rena. 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 vault trusted a swap-derived value for any synth, including synths of arbitrary custom tokens, without checking that the token had real liquidity or was approved.

Impact

An attacker could earn almost all vault rewards, though the project noted that rewards can be claimed by anyone in a fee-bidding war and no extra inflation occurs.

What the attacker needed

Ability to create custom tokens and synths; some BASE tokens for liquidity and minting

The fix

The vault should only allow synths of curated tokens with sufficient liquidity depth, and calculate weight using a swap value that accounts for slippage so a small manipulated pool cannot qualify.

How it was found

  1. Create a custom token and give a large supply to the attacker.
  2. Create a synth for that custom token.
  3. Add liquidity to the token/base pair with a tiny amount of token and a large amount of base, making the token price very high.
  4. Mint synths by paying base to the pool.
  5. Deposit the fake synth so the member weight becomes very high.
  6. Call harvest with a synth that has real value to collect rewards.

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.

The vault gave reward points based on how much a deposited token was worth, but it let anyone create new tokens and set their price. So a person could make a worthless token look expensive, deposit it, and get a huge share of the rewards meant for real depositors.

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 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.