Skip to content
Business logic Audit finding Advanced

SynthVault rewards can be gamed

The SynthVault contract calculates a user's reward weight using the spot price of a synth token, which can be manipulated by trading in the associated liquidity pool. An attacker could inflate their weight with a small deposit and claim a disproportionate share of rewards.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The SynthVault._deposit function adds weight for the user that depends on the spot value of the deposit synth amount in BASE.

This spot price can be manipulated and the cost of manipulation is relative to the pool’s liquidity. However, the reward (see calcReward) is measured in BASE tokens unrelated to the pool. Therefore, if the pool’s liquidity is low and the reward reserve is high, the attack can be profitable:

  1. Manipulate the pool spot price of the iSYNTH(_synth).LayerONE() pool by dripping a lot of BASE into it repeatedly (sending lots of smaller trades is less costly due to the path-independence of the continuous liquidity model). This increases the BASE per token price.
  2. Call SynthVault.depositForMember and deposit a small amount of synth token. The iUTILS(_DAO().UTILS()).calcSpotValueInBase(iSYNTH(_synth).LayerONE(), _amount) will return an inflated weight due to the price.
  3. Optionally drip more BASE into the pool and repeat the deposits
  4. Drip back token to the pool to rebalance it

The user’s weight is now inflated compared to the deposited / locked-up amount and they can claim a large share of the rewards. The cost of the attack depends on the pool’s liquidity and the profit depends on the reserve. It could therefore be profitable under certain circumstances.

Recommend tracking a TWAP price of the synth instead, store the deposited synths instead, and compute the weight & total weight on the fly based on the TWAP * deposit amount instead of at the time of deposit.

verifyfirst (Spartan) acknowledged:

There is already a discussion in place to change spot rate to swap rate calculation for weights.

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

Impact

The attacker could claim a large share of the rewards, and the attack could be profitable if the pool's liquidity is low and the reward reserve is high.

What the attacker needed

Ability to trade in the synth's liquidity pool; low pool liquidity relative to reward reserve

The fix

The project should track a TWAP price of the synth, store the deposited synths, and compute weight based on the TWAP times deposit amount instead of the spot price at deposit time.

How it was found

  1. Manipulate the pool spot price by repeatedly trading BASE for the synth token, increasing the BASE per token price.
  2. Call SynthVault.depositForMember with a small amount of synth token; the spot value calculation returns an inflated weight.
  3. Optionally repeat the price manipulation and deposits to further inflate weight.
  4. Trade back the synth token to the pool to rebalance it.

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.

A vault gives rewards based on how much you deposit, but it uses the current market price of the token you deposit to decide your share. An attacker can temporarily push that price up by trading in a pool, then deposit a tiny amount to get a huge share of the rewards. This works because the reward pool is separate from the trading pool, so the attacker can profit if the reward pool is large compared to the trading pool's liquidity.

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 cmichel

View all

196 more disclosed reports, best first.

More from Spartan 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.