Skip to content
Business logic Audit finding Intermediate

IV Can be Decreased for Free

The implied volatility (IV) used for loan risk is calculated from liquidity in a single tick spacing, which can be temporarily inflated by depositing and then removing liquidity in the same block. This allows an attacker to decrease IV at near-zero cost, increasing the loan-to-value ratio and enabling excessive leverage or avoidance of liquidation.

Bandit Follow with mstpr-brainbot and roguereddwarf

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-10-aloe-judging/issues/63

Found by

Bandit, mstpr-brainbot, roguereddwarf

The liquidity parameter used to calculate IV costs nothing to massively manipulate upwards and doesn't require a massive amount of capital. This makes IV easy to manipulate downwards.

Vulnerability Detail

The liquidity at a single tickSpacing is used to calcualte the IV. The more liquidity is in this tick spacing, the lower the IV, as demonstarated by the tickTvl dividing the return value of the estimate function:

Solidity
            return SoladyMath.sqrt((4e24 * volumeGamma0Gamma1 * scale) / (b.timestamp - a.timestamp) / tickTvl);

Since this is using data only from the block that the function is called, the liuquidyt can easily be increased by:

  1. depositing a large amount liquidity into the tickSpacing
  2. calling update
  3. removing the liquidity

Note that only a small portion of the total liquidity is in the entire pool is in the active liquidity tick. Therefore, the capital cost required to massively increase the liquidity is low. Additionally, the manipulation has zero cost (aside from gas fees), as no trading is done through the pool. Contract this with a pool price manipulation, which costs a significant amount of trading fees to trade through a large amount of the liquidity of the pool.

Since this manipulation costs nothing except gas, the IV_CHANGE_PER_UPDATE which limits of the amount that IV can be manipulated per update does not sufficiently disincentivise manipulation, it just extends the time period required to manipulate.

Decreasing the IV increases the LTV, and due to the free cost, its reasonable to increase the LTV to the max LTV of 90% even for very volatile assets. Aloe uses the IV to estimate the probability of insolvency of loans. With the delay inherent in TWAP oracle and the liquidation delay by the warn-then-liquidate process, this manipulation can turn price change based insolvency from a 5 sigma event (as designed by the protocol) to a likely event.

Impact

  • Decreasing IV can be done at zero cost aside from gas fees.
  • This can be used to borrow assets at far more leverage than the proper LTV
  • Borrowers can use this to avoid liquidation
  • This also breaks the insolvency estimation based on IV for riskiness of price-change caused insolvency.

Code Snippet

https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/libraries/Volatility.sol#L44-L81

Tool used

Manual Review

Recommendation

Use the time weighted average liquidity of in-range ticks of the recent past, so that single block + single tickSpacing liquidity deposits cannot manipulate IV significantly.

Discussion

sherlock-admin2

1 comment(s) were left on this issue during the judging contest.

MohammedRizwan commented:

valid

panprog

Escalate

This should be medium, not high. While the volatility can really be decreased and allows more risky positions to be healthy, this will not cause any immediate loss of funds. Liquidations will still happen normally even with 90% LTV. In order to actually cause some loss of funds - a large and quick change of price is required, when liquidators can not liquidate in time. And this is not very likely event, so medium is more appropriate.

sherlock-admin2

Escalate

This should be medium, not high. While the volatility can really be decreased and allows more risky positions to be healthy, this will not cause any immediate loss of funds. Liquidations will still happen normally even with 90% LTV. In order to actually cause some loss of funds - a large and quick change of price is required, when liquidators can not liquidate in time. And this is not very likely event, so medium is more appropriate.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

roguereddwarf

Considering that IV and dynamic LTV is the main security mechanism to deal with sudden price movements and one of Aloe's main selling points is the robustness against sudden price movements, I think this can be considered a High.

We have seen in crypto many times how a pair can move 10% within minutes which is enough to cause bad debt and a loss to lenders.

If the manipulation wasn't possible, the LTV would be much lower for such a pair.

haydenshively

Fixed in https://github.com/aloelabs/aloe-ii/pull/214

cvetanovv

haydenshively Do you think it should stay High or be downgraded to Medium?

haydenshively

I think High makes sense because of how important IV is to the protocol

Czar102

This issue presents a bypass of protocol's risk management, hence I think High severity is accurate. Planning to reject the escalation and leave the issue as is.

Czar102

Result: High Has duplicates

sherlock-admin2

Escalations have been resolved successfully!

Escalation status:

The original report as published on Sherlock, by Bandit. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 IV calculation uses only the current block's liquidity in a single tick spacing, which can be manipulated by a flash deposit and withdrawal.

Impact

This can be used to borrow at higher leverage than intended and to avoid liquidation, potentially turning a 5-sigma insolvency event into a likely one, though immediate loss requires a large and quick price change.

What the attacker needed

Ability to deposit and withdraw liquidity; gas fees only

The fix

The IV calculation should use the time-weighted average liquidity of in-range ticks over a recent period, so that single-block deposits cannot manipulate it.

How it was found

  1. Deposit a large amount of liquidity into the tick spacing.
  2. Call the update function.
  3. Remove the liquidity.

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.

This report is about a decentralised lending protocol that uses a measure called implied volatility (IV) to decide how risky a loan is. IV is supposed to reflect how much the price of an asset might jump around. The problem is that the protocol calculates IV from the amount of liquidity (funds available for trading) in a very narrow price range at a single moment. An attacker can temporarily add a lot of liquidity to that range, which makes IV appear lower, then remove it. This tricks the system into thinking the asset is safer than it is, so the attacker can borrow more or avoid liquidation.

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 Bandit

View all

6 more disclosed reports, best first.

More from Aloe

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.