EigenLayer Contest - ToonVH's results

Enabling restaking of staked Ether, to be used as cryptoeconomic security for decentralized protocols and applications.

General Information

Platform: Code4rena

Start Date: 27/04/2023

Pot Size: $90,500 USDC

Total HM: 4

Participants: 43

Period: 7 days

Judge: GalloDaSballo

Id: 233

League: ETH

EigenLayer

Findings Distribution

Researcher Performance

Rank: 23/43

Findings: 1

Award: $534.79

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: ABA

Also found by: 0xWaitress, 8olidity, ABA, MiloTruck, ToonVH, bughunter007, bytes032, juancito, rvierdiiev

Labels

bug
2 (Med Risk)
satisfactory
duplicate-132

Awards

534.7892 USDC - $534.79

External Links

Lines of code

https://github.com/code-423n4/2023-04-eigenlayer/blob/main/src/contracts/core/StrategyManager.sol#L780-L794

Vulnerability details

Impact

If a Strategy is hacked/selfdestructs such that it reverts when withdraw() is called, then all currently queued withdrawals in StrategyManager containing that strategy are frozen and the funds from non-hacked strategies in that withdrawal are lost. This is because a queuedWithdrawal has to be withdrawn as a whole or not at all.

for (uint256 i = 0; i < strategiesLength;) {
    if (queuedWithdrawal.strategies[i] == beaconChainETHStrategy) {

        // if the strategy is the beaconchaineth strat, then withdraw through the EigenPod flow
        _withdrawBeaconChainETH(queuedWithdrawal.depositor, msg.sender, queuedWithdrawal.shares[i]);
    } else {
        // tell the strategy to send the appropriate amount of funds to the depositor
        queuedWithdrawal.strategies[i].withdraw(
            msg.sender, tokens[i], queuedWithdrawal.shares[i]
        );
    }
    unchecked {
        ++i;
    }
}

Proof of Concept

  1. Bob has 100 tokens each in strategies A, B, C and D.
  2. Bob queues a withdrawal for all his tokens for these 4 strategies.
  3. Strategy B suffers some exploit and now reverts when withdraw() is called.
  4. When Bob calls completeQueuedWithdrawal() it reverts since strategyB.withdraw() reverts.

Bob now not only lost his tokens in strategy B (expected), but also those for strategy A, C and D (unexpected).

Tools Used

Manual review

  • Allow skipping strategies when completing a withdrawal. Similar to how indicesToSkip functions in slashQueuedWithdrawal()

Assessed type

Loop

#0 - c4-pre-sort

2023-05-09T13:39:10Z

0xSorryNotSorry marked the issue as duplicate of #132

#1 - c4-judge

2023-06-01T11:45:33Z

GalloDaSballo marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter