Skip to content
Business logic Audit finding Intermediate

Lido adapter incorrectly calculates the price of the underlying token

The Lido adapter's price function returns the value of WstETH in terms of stETH, not the desired underlying WETH. This incorrect price can over- or understate the harvestable amount, leading to value leakage.

AuditsAreUS Follow

Originally disclosed on Code4rena

Submitted by AuditsAreUS

The Lido adapter incorrectly calculates the price of WETH in terms of WstETH.

The function returns the price of WstETH in terms of stETH. The underlying token which we desire is WETH. Since stETH does not have the same value as WETH the output price incorrect.

The impact is severe as all the balance calculations require the price of the yield token converted to underlying. The incorrect price may over or understate the harvestable amount which is a core calculation in the protocol.

Proof of Concept

The function IWstETH(token).getStETHByWstETH() only converts WstETH to stETH. Thus, price() returns the value of WstETH in terms of stETH.

    function price() external view returns (uint256) {
        return IWstETH(token).getStETHByWstETH(10**SafeERC20.expectDecimals(token));
    }

Recommended Mitigation Steps

Add extra steps to price() to approximate the rate for converting stETH to ETH. This can be done using the same curve pool that is used to convert stETH to ETH in unwrap().

0xfoobar (Alchemix) disputed and commented:

The design mechanism relies upon stETH reaching eventual 1:1 redeemability for ETH after the merge and shanghai enables withdrawals. This is core to out like-kind collateral/asset model. We will update the stETH token adapter at that time to do direct redemptions instead of Curve swaps. So in the meantime, the protocol accrues discounted assets.

0xleastwood (judge) decreased severity to Medium and commented:

While the sponsor’s comments suggest that this will be a non-issue after the merge/shanghai enables withdrawals, I believe there is legitimacy in the fact that the protocol will accrue discounted assets. It does not lead to the loss of assets, but value can be leaked if WETH is priced incorrectly. As such, I’m downgrading this to medium severity.


The original report as published on Code4rena, by AuditsAreUS. 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 price function only converts WstETH to stETH, omitting the conversion from stETH to ETH (WETH).

Impact

The incorrect price may over- or understate the harvestable amount, which is a core calculation, leading to value leakage (though not direct loss of assets).

What the attacker needed

None

The fix

The price function should be updated to include an extra step that approximates the conversion rate from stETH to ETH, for example by using the same Curve pool as in unwrap().

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 smart contract that calculates the price of a token. The code mistakenly uses the value of one token (stETH) instead of the correct one (WETH), so the price is wrong. That wrong price can cause the protocol to miscalculate how much can be harvested, potentially losing value.

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 AuditsAreUS

View all

9 more disclosed reports, best first.

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