Submitted by ladboy233, also found by immeas, 0xdeadbeef0x, bin2chen, minhtrng, and SaeedAlipoor01988
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/ETHPoolLPFactory.sol#L76
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/StakingFundsVault.sol#L380
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/ETHPoolLPFactory.sol#L122
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/ETHPoolLPFactory.sol#L130
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/ETHPoolLPFactory.sol#L83
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/LiquidStakingManager.sol#L551
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/contracts/liquid-staking/LiquidStakingManager.sol#L940
The user is not able to stake the 32 ETH for validators because the staking fund vault LP total supply exceeds 4 ETHER.
After the smart wallet, staking fund vault and savETH vault has 32 ETH, the user should be able to call:
before the staking, the validation function is called:
which calls:
note that the code requires the total supply of the stakingFundsLP to be equal to 4 ETHER
however, user can call the function rotateLPTokens to mint more than 4 ETHER of the stakingFundsLP because of the incorrect implementation of the ETHPoolLPFactory.sol#rotateLPTokens
note that stakingFundVault inherits from ETHPoolFactory.sol
so user call rotateLPTokens on StakingFundsVault
note the line:
the correct implementaton should be:
The 24 ETH is hardcoded, but when the stakingFundsVault.sol is init, the maxStakingAmountPerValidator is set to 4 ETH.
note the line:
this parameter maxStakingAmountPerValidator restrict users ETH deposit amount
note the line:
However, such restriction when rotating LP is changed to
So to sum it up:
When user stakes, the code strictly requires the stakingFundVault LP total supply is equal to 4 ETH:
However, when rotating the LP, the maxStakingAmountPerValidator for staking fund LP becomes 24 ETH, which exceeds 4 ETH (the expected maxStakingAmountPerValidator)
First we need to add the import in LiquidStakingManager.t.sol
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/test/foundry/LiquidStakingManager.t.sol#L12
https://github.com/code-423n4/2022-11-stakehouse/blob/4b6828e9c807f2f7c569e6d721ca1289f7cf7112/test/foundry/LiquidStakingManager.t.sol#L35
then we add the POC:
We run the POC:
the output is:
the total supply of the LP exceeds 4 ETH and the transaction precisely reverts in:
Manual Review, Foundry
We recommend the project change from
to
and change from
we change from == balance check to >=, because == balance check is too strict in this case.
vince0656 (Stakehouse) confirmed
Trust (warden) commented:
LSDan (judge) decreased severity to Medium and commented:
