Skip to content
Business logic Audit finding Intermediate

SynthVault deposit lockup bypass

The SynthVault.harvestSingle function mints synth tokens based on the total BASE balance sent to the pool, including any BASE tokens an attacker transfers beforehand. An attacker can therefore mint and deposit synths without a lockup period, crediting the entire amount to their weight.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The SynthVault.harvestSingle function can be used to mint & deposit synths without using a lockup. An attacker sends BASE tokens to the pool and then calls harvestSingle. The inner iPOOL(_poolOUT).mintSynth(synth, address(this)); call will mint synth tokens to the vault based on the total BASE balance sent to the pool, including the attacker’s previous transfer. They are then credited the entire amount to their weight.

This essentially acts as a (mint +) deposit without a lock-up period.

Recommend syncing the pool before sending BASE to it through iRESERVE(_DAO().RESERVE()).grantFunds(reward, _poolOUT); such that any previous BASE transfer is wasted. This way only the actual reward’s weight is increased.

verifyfirst (Spartan) disputed:

Although this is true, the attacker is not benefiting from any gain. They are only minting extra synths into the synthVault into their weight. It is no different to - minting and then staking into the vault.

SamusElderg (Spartan) confirmed:

@verifyfirst (Spartan) in my opinion this one should be confirmed and the recommended mitigation also makes sense; any attempt to send in BASE by a bad actor can be attributed to the existing LPers instead

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

Root cause

Likely the harvest function calculates minted synths from the pool's total BASE balance without first syncing the pool, so any BASE tokens sent directly to the pool are counted as part of the reward.

Impact

An attacker could mint and deposit synths without a lockup period, gaining weight in the vault; however, one party disputed that this provides any real benefit, comparing it to normal minting and staking.

What the attacker needed

Ability to send BASE tokens to the pool; ability to call harvestSingle

The fix

The pool should be synced before sending BASE to it via grantFunds, so that any previous BASE transfer is wasted and only the actual reward's weight is increased.

How it was found

  1. Send BASE tokens to the pool.
  2. Call harvestSingle.
  3. The function mints synths based on the total BASE balance, including the sent tokens.
  4. The attacker is credited the entire amount to their weight.

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 lets people deposit tokens and earn rewards, but normally you must lock your tokens for a while. The harvest function mints new tokens based on how many base tokens are in the pool. An attacker can send extra base tokens to the pool first, then call harvest, so they get credit for those extra tokens without locking anything.

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.