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.
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:
- Monitor the mempool and the beacon chain to know in advance if either the
eETHoruniETHtokens will lose value. - Frontrun the value loss by redeeming their
PTandYTtokens via Tranche::redeemWithYT(), which will call BaseLSTAdapter::prefundedRedeem(), in exchange forETH.
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:
- Monitor the Bedrock validators on the beacon chain for penalties and slashings.
- Call Tranche::redeemWithYT() to redeem
PT/YTin exchange ofETH. - Call EigenPod::verifyBalanceUpdates()/EigenPod::verifyAndProcessWithdrawals() to notify Eigenlayer of the balance drop.
- The value of
uniETHwill instantly drop. - Deposit the previously withdrawn
ETHfor moreYT/PTtokens 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
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
- Monitor the mempool and the beacon chain to know in advance if either the eETH or uniETH tokens will lose value.
- Frontrun the value loss by redeeming PT and YT tokens via Tranche::redeemWithYT(), which calls BaseLSTAdapter::prefundedRedeem(), in exchange for ETH.
- Call EigenPod::verifyBalanceUpdates() or EigenPod::verifyAndProcessWithdrawals() to notify Eigenlayer of the balance drop.
- The value of uniETH will instantly drop.
- 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.