Closed code423n4 closed 1 year ago
0xSorryNotSorry marked the issue as primary issue
In the case where an incorrect index is supplied, there is a fallback routine which will ultimately trigger here https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L721-L736
Sidu28 marked the issue as sponsor disputed
I believe this is more of a feature than a bug, so am closing
GalloDaSballo marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L370-L374 https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L501-L505 https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L701 https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L715-L740
Vulnerability details
Proof of Concept
strategyIndexes
is used to indicate which strategies the caller will withdraw 100% of his shares, but it can contain any value when callingStrategyManager.queueWithdrawal()
andStrategyManager.slashShares()
.These two functions will reuse
StrategyManager._removeShares()
, which callsStrategyManager._removeStrategyFromStakerStrategyList()
which does not enforce for the index and the strategy to match.https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L370-L374
https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L501-L505
https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L701
https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L715-L740
Impact
The caller might pass some indexes that are not going to be removed if they don't match the strategy and this can result in silent failures, since no revert will take place.
Removing strategies incorrectly or in an unexpected way might break the shares accounting and withdrawals logic.
Tools Used
Manual review.
Recommendation
I would recommend to not reuse
StrategyManager._removeStrategyFromStakerStrategyList()
when callingStrategyManager.queueWithdrawal()
andStrategyManager.slashShares()
, and create a new function that enforces the correct index to match, e.g. revert if the index being pass doesn't match the strategy.If
strategyIndexes
was intended to be optional, an alternative can be two create two versions forStrategyManager.queueWithdrawal()
andStrategyManager.slashShares()
, where the first version receives and validatesstrategyIndexes
and the second version doesn't receivestrateIndexes
and scan for the indexes manually to match the strategy to withdraw all the shares.Assessed type
Invalid Validation