Skip to content
Race condition Audit finding Advanced

Users can frontrun LSTs/LRTs tokens prices decrease in order to avoid losses

Users can redeem PT/YT tokens for ETH before a price decrease of a supported LST/LRT token, avoiding losses that would otherwise be shared among stakers. An attacker can monitor the mempool and beacon chain to frontrun the value drop and then deposit the withdrawn ETH for more tokens.

zzykxx Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-05-napier-update-judging/issues/65

The protocol has acknowledged this issue.

Found by

zzykxx

Summary

Users can redeem their PT/YT tokens before a price decrease of a supported LST/LRT token in order to avoid losses.

Vulnerability Detail

Napier allows users to redeem their PT/YT tokens for ETH via BaseLSTAdapter::prefundedRedeem() instantly if the amount to be withdrawn is lower or equal than the available ETH buffer. The in-scope adapters that allow this are:

A Napier user that staked in one of these adapters can:

  1. Monitor the mempool and the beacon chain to know in advance if either the eETH or uniETH tokens will lose value.
  2. Frontrun the value loss by redeeming their PT and YTtokens via Tranche::redeemWithYT(), which will call BaseLSTAdapter::prefundedRedeem(), in exchange for ETH.

Because the value drop is still not reflected in the Napier protocol the staker will be able to withdraw his funds without being affected by the losses.

In the case of eETH, a rebase token, an attacker can know if a balance drop will happen by monitoring the mempool for calls to rebase() in the EtherFi LiquidityPool contract.

In the case of uniEth an attacker can know if the token will lose value by monitoring the protocol validators for penalties and slashing events. Bedrock (uniEth) is built on top of Eigenlayer, which can be notified of balance drops due to penalties or slashings via two permissionless functions: EigenPod::verifyBalanceUpdates() and EigenPod::verifyAndProcessWithdrawals(). This allows an attacker to perform the following series of calls atomically to avoid losses:

  1. Monitor the Bedrock validators on the beacon chain for penalties and slashings.
  2. Call Tranche::redeemWithYT() to redeem PT/YT in exchange of ETH.
  3. Call EigenPod::verifyBalanceUpdates()/EigenPod::verifyAndProcessWithdrawals() to notify Eigenlayer of the balance drop.
  4. The value of uniETH will instantly drop.
  5. Deposit the previously withdrawn ETH for more YT/PT tokens than the initial amount.

Another instance that instantly lowers the value held by the UniEthAdapter adapter is the call to UniETHAdapter::swapUniETHForETH() because a 0.05% fee is paid to UniswapV3, this can also be front run by stakers to avoid bearing the losses of the fee.

Impact

Stakers can avoid losses, which implies honest stakers will lose more than they should.

Code Snippet

Tool used

Manual Review

Recommendation

Introduce a withdraw queue, this will prevent this kind of frontrunning attacks.

Discussion

massun-onibakuchi

It is known behavior seen in many LST/LRT integrations like DEX

The original report as published on Sherlock, by zzykxx. 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 instant redemption mechanism allows users to withdraw at the old price before a value decrease is reflected in the protocol.

Impact

Stakers can avoid losses, which implies honest stakers will lose more than they should.

What the attacker needed

A Napier user staked in EETHAdapter or UniEthAdapter; ability to monitor mempool and beacon chain; available ETH buffer in the adapter

The fix

Introduce a withdraw queue to prevent this kind of frontrunning attack.

How it was found

  1. Monitor the mempool and the beacon chain to know in advance if either the eETH or uniETH tokens will lose value.
  2. Frontrun the value loss by redeeming PT and YT tokens via Tranche::redeemWithYT(), which calls BaseLSTAdapter::prefundedRedeem(), in exchange for ETH.
  3. Call EigenPod::verifyBalanceUpdates() or EigenPod::verifyAndProcessWithdrawals() to notify Eigenlayer of the balance drop.
  4. The value of uniETH will instantly drop.
  5. Deposit the previously withdrawn ETH for more YT/PT tokens than the initial amount.

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 is a decentralised finance (DeFi) protocol where users stake tokens that represent staked ETH (called LSTs or LRTs). If the value of those tokens drops, normally all stakers share the loss. But because users can withdraw instantly, someone who sees the drop coming can take their money out first, leaving the loss to everyone else.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by zzykxx

View all

6 more disclosed reports, best first.

More from Napier Finance - LST/LRT Integrations

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.