Skip to content
Smart contracts Write-up Advanced

Vesper Rebase Vulnerability Bug Fix Review And Bug Bounty

The Vesper rebalance function could be called by anyone during a flash loan, allowing an attacker to manipulate the VSP price on Uniswap and steal the yield generated by the strategy. The maximum funds at risk were 78.6 ETH, but the vulnerability was never exploited and was quickly fixed.

immunefi.com

Published on immunefi.com

The Dedaub Team, led by Yannis Smaragdakis and Neville Grech, requested disclosure assistance from Immunefi for a vulnerability found in the bluechip DeFi project Vesper on March 16. The maximum funds at risk historically appears to have been 78.6 ETH, a third of which would have gone to fees as part of the attack.

The author, on immunefi.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the rebalance function was publicly callable and relied on the assumption that only the bot would call it promptly, allowing an attacker to manipulate the swap price via a flash loan.

Impact

An attacker could steal the yield generated by Vesper's strategies, with a maximum of 78.6 ETH at risk, but the attack was never executed and no user funds were at risk.

What the attacker needed

Ability to call rebalance; flash loan available; Uniswap pool for WETH/VSP

The fix

Vesper patched the vulnerability by increasing the frequency of rebalances so that each individual rebalance is smaller than the flash loan and swap fees, making the attack unprofitable.

How it was found

  1. Take a flash loan in WETH
  2. Swap the WETH for VSP on Uniswap, inflating the VSP price
  3. Call VVSP.rebalance
  4. VVSP.rebalance calls VSPStrategy.rebalance, which calls VSPStrategy._rebalanceEarned, which executes a swap
  5. The swap exchanges WETH for VSP at the inflated price, giving the strategy less VSP than normal
  6. When the flash loan is swapped back, most of the WETH from rebalance ends up with the attacker

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 write-up has not been written yet. The Original tab links to the source.

Vesper is a DeFi project that earns yield for its users. The rebalance function, which distributes that yield, could be called by anyone. An attacker could use a flash loan (a large, instant loan) to temporarily inflate the price of VSP tokens, then call rebalance so that the strategy bought VSP at the inflated price, letting the attacker profit from the difference. This meant the yield could be stolen, but the attack was never carried out and was fixed.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.