Skip to content
Business logic Audit finding Intermediate

Rebalance profit requirement prevents maintaining VETH/WETH peg

The rebalance function requires a strictly positive profit, so it cannot run when restoring the VETH/WETH peg would break even. This prevents the protocol from maintaining the 1:1 ratio during unprofitable market conditions.

Evo Follow

Originally disclosed on Code4rena

Submitted by Evo

https://github.com/code-423n4/2024-12-lambowin/blob/b8b8b0b1d7c9733a7bd9536e027886adb78ff83a/src/rebalance/LamboRebalanceOnUniwap.sol#L62

The profit > 0 requirement in the rebalance function actively prevents the protocol from maintaining the VETH/WETH 1:1 peg during unprofitable market conditions, when profit is ZERO.

Proof of Concept

The protocol documentation and team’s design goals that the RebalanceOnUniswap contract is specifically designed to maintain the VETH/WETH pool ratio at 1:1, intentionally accepting gas losses as a trade-off for improved price stability.

It is mentioned in the previous audit, In the sponsor’s acknowledgement (from SlowMist audit, N12):

According to the project team, the RebalanceOnUniswap contract is designed to maintain the VETH/WETH pool ratio at 1:1 rather than for profit. Gas costs are intentionally omitted to increase rebalancing frequency, accepting gas losses as a trade-off for improved price stability.

However, in LamboRebalanceOnUniwap.sol#L68:

    function rebalance(uint256 directionMask, uint256 amountIn, uint256 amountOut) external nonReentrant {
	    uint256 balanceBefore = IERC20(weth).balanceOf(address(this));
	    bytes memory data = abi.encode(directionMask, amountIn, amountOut);
	    IMorpho(morphoVault).flashLoan(weth, amountIn, data);
	    uint256 balanceAfter = IERC20(weth).balanceOf(address(this));
	    uint256 profit = balanceAfter - balanceBefore;
	    require(profit > 0, "No profit made");
}

The require(profit > 0) check means:

  • Rebalancing can only occur when profitable, in situations where rebalancing is needed but arbitrage profits are zero, this directly contradicts the protocol’s stated design goal of accepting no profit to maintain the ratio 1:1.

An example scenario would be:

  • VETH/WETH ratio deviates from 1:1
  • Rebalancing opportunity exists to restore the peg
  • Market conditions mean rebalancing would offer no profit but can still done
  • The profit check prevents rebalancing

Recommended Mitigation Steps

Update the require(profit > 0) to require(profit >= 0).

Shaneson (Lambo.win) acknowledged


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

The rebalance function enforces a strict profit requirement instead of allowing break-even rebalances needed to maintain the peg.

Impact

The protocol may be unable to restore the VETH/WETH 1:1 peg when rebalancing would yield zero profit, undermining its stated price-stability goal.

What the attacker needed

VETH/WETH ratio deviates from 1:1; rebalancing would yield zero profit

The fix

The check should be changed to allow zero profit, so break-even rebalances can proceed.

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 smart contract is code on a blockchain. This one is meant to keep two tokens, VETH and WETH, trading at equal value by rebalancing a pool. But it only allows a rebalance if the contract makes money, so when keeping the peg would break even, the rebalance is blocked.

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 Evo

View all

7 more disclosed reports, best first.

More from Lambo.win

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.