Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karsar - user who request withdraw before vault start balance is still accounted in the vault . #167

Open
sherlock-admin4 opened this issue Sep 21, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link

sherlock-admin4 commented Sep 21, 2024

karsar

Medium

user who request withdraw before vault start balance is still accounted in the vault .

Summary

if the user whos withdraw request was set before the vault started and withdrawn after vault start will increase fixedSidestETHOnStartCapacity .

Vulnerability Detail

If the user request withdraw before vault start which increases the fixedSidestETHOnStartCapacity and that fixedSidestETHOnStartCapacity is used for calculating withdraw amount .
if the user has deposited a large amount of deposit and request before the vault starts then the user who withdraw will be calculated with that large staking balance which could lead to wrong price being withdrawn

In Withdraw function the fixedETHDeposits is used ,

             uint256 fixedETHDeposits = fixedSidestETHOnStartCapacity;
      
        uint256 withdrawAmount = fixedETHDeposits.mulDiv(fixedBearerToken[msg.sender], fixedLidoSharesTotalSupply());
        uint256 lidoStETHBalance = stakingBalance();

        if (fixedETHDeposits > lidoStETHBalance) {
     
          // our staking balance if less than our  stETH deposits at the start of the vault - only return a proportional amount of the balance to the fixed user
          withdrawAmount = lidoStETHBalance.mulDiv(fixedBearerToken[msg.sender], fixedLidoSharesTotalSupply());
        }

Impact

incorrect accounting

Code Snippet

https://github.com/sherlock-audit/2024-08-saffron-finance/blob/main/lido-fiv/contracts/LidoVault.sol#L488

Tool used

Manual Review

Recommendation

dont account balance of user who has withdrawn before vault staarted

@sherlock-admin4 sherlock-admin4 changed the title Prehistoric Crepe Jellyfish - user who request withdraw before vault start balance is still accounted in the vault . karsar - user who request withdraw before vault start balance is still accounted in the vault . Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant