When the Stader Stake Pools Manager calls stakeUserETHToBeacon chain, it does so calculating the requiredValidators that can be added to the pool. The function internally also uses the allocateValidatorsAndUpdaterOperatorId to compute each operator's capacity. StakeUserETHToBeaconChain then will do a preDeposit on the beacon chain using the value calculated from allocateValidatorsAndUpdateOperators. This means that only validatorToDeposit validators are actually active, however the function will add requiredValidators to the PermissionedNodeRegistry's totalActiveValidatorCount. This will lead to incorrect calculations for any subsequent validator deposits.
Lines of code
https://github.com/code-423n4/2023-06-stader/blob/7566b5a35f32ebd55d3578b8bd05c038feb7d9cc/contracts/PermissionedPool.sol#L125
Vulnerability details
Impact
When the Stader Stake Pools Manager calls
stakeUserETHToBeacon
chain, it does so calculating therequiredValidators
that can be added to the pool. The function internally also uses theallocateValidatorsAndUpdaterOperatorId
to compute each operator's capacity.StakeUserETHToBeaconChain
then will do apreDeposit
on the beacon chain using the value calculated fromallocateValidatorsAndUpdateOperators
. This means that onlyvalidatorToDeposit
validators are actually active, however the function will addrequiredValidators
to thePermissionedNodeRegistry
'stotalActiveValidatorCount
. This will lead to incorrect calculations for any subsequent validator deposits.Proof of Concept
https://github.com/code-423n4/2023-06-stader/blob/7566b5a35f32ebd55d3578b8bd05c038feb7d9cc/contracts/PermissionedPool.sol#L125
Tools Used
Manual review.
Recommended Mitigation Steps
Only add
validatorToDeposit
to thetotalValidatorCount
.Assessed type
Loop