Withdrawing after a slash event before the vault has ended will decrease `fixedSidestETHOnStartCapacity` by less than it should, so following users will withdraw more their initial deposit
When a Lido slashing event reduces the stETH share ratio, a fixed depositor withdrawing before vault end receives a reduced amount, but the contract decreases the fixed capacity by that same reduced amount instead of the original deposit equivalent. This lets later fixed depositors withdraw more than their initial deposit if the ratio recovers, with the extra coming at the expense of variable depositors.
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-08-saffron-finance-judging/issues/92
The protocol has acknowledged this issue.
Found by
0x73696d616f
Summary
In LidoVault::withdraw(), when the vault has started but not ended, it limits the value to withdraw if a slashing event occured and withdraws lidoStETHBalance.mulDiv(fixedBearerToken[msg.sender], fixedLidoSharesTotalSupply());. However, it also decreases fixedSidestETHOnStartCapacity by this same amount, which means that next users that withdraw will get more than their initial deposit in case the Lido ratio comes back up (likely during the vault's duration).
It's clear from the code users should get exactly their initial amount of funds or less, never more, as the comment indicates:
since the vault has started only withdraw their initial deposit equivalent in stETH at the start of the vault- unless we are in a loss
Root Cause
In LidoVault.sol:498, fixedSidestETHOnStartCapacity is decreased by a lower amount than it should.
Internal pre-conditions
None.
External pre-conditions
Lido slash, which is in scope as per the readme.
The Lido Liquid Staking protocol can experience slashing incidents (such as this https://blog.lido.fi/post-mortem-launchnodes-slashing-incident/). These incidents will decrease income from deposits to the Lido Liquid Staking protocol and could decrease the stETH balance. The contract must be operational after it
Attack Path
- Lido slashes, decreasing the steth ETH / share ratio.
- User withdraws, taking a loss and decreasing
fixedSidestETHOnStartCapacitywith the lossy amount. - Next user withdrawing will withdraw more because
fixedSidestETHOnStartCapacitywill be bigger than it should.
Impact
Fixed deposit users benefit from the slashing event at the expense of variable users who will take the loss.
PoC
Assume that there 100 ETH and 100 shares.
A slashing event occurs and drops the ETH to 90 and shares remain 100.
There are 2 fixed depositors, with 50% of the deposits each.
User A withdraws, and should take 100 ETH * 50 / 100 == 50 ETH, but takes 90 ETH * 50 / 100 == 45 ETH instead due to the loss.
fixedSidestETHOnStartCapacity is decreased by 45 ETH, the withdrawn amount, so it becomes 55 ETH.
Now, when LIDO recovers from the slashing, the contract will hold more steth than fixedSidestETHOnStartCapacity, more specifically the remaining 45 ETH in the contract that were not withdrawn yet are worth 50 ETH now. So user B gets
fixedSidestETHOnStartCapacity * 50 / 50 == 55.
As the fixed deposit user initially deposited 50, but claimed 55 now, it is getting much more than it should at the expense of the variable users who will take the loss.
Mitigation
The fixedSidestETHOnStartCapacity should be always reduced by fixedETHDeposits.mulDiv(fixedBearerToken[msg.sender], fixedLidoSharesTotalSupply());, such that users get their equivalent ETH from their initial deposit back and the variable users don't take losses.
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 contract reduces `fixedSidestETHOnStartCapacity` by the actual withdrawn amount (which is reduced by the slashing loss) instead of by the original deposit equivalent, so the capacity remains too high after a loss.
Impact
Fixed deposit users could benefit from a slashing event at the expense of variable users, who may take the loss.
What the attacker needed
Lido slashing event occurs; Vault has started but not ended; Fixed depositor withdraws before vault end
The fix
The `fixedSidestETHOnStartCapacity` should always be reduced by the original deposit equivalent, not the loss-adjusted withdrawn amount.
How it was found
- A Lido slashing event occurs, reducing the stETH to ETH ratio.
- A fixed depositor withdraws before the vault ends, receiving a reduced amount due to the loss.
- The contract decreases `fixedSidestETHOnStartCapacity` by that reduced amount.
- If the Lido ratio recovers, the next fixed depositor can withdraw more than their initial deposit.
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 slashing event means the staking service lost some of the deposited money, so each share is worth less. When the first person withdraws, they get less money back, but the contract also reduces a shared counter by that smaller amount. If the value recovers later, the next person can withdraw more than they originally put in, and that extra comes from other users' funds.
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.