Skip to content
Smart contracts Audit finding Advanced

Malicious operators can `undelegate` theirselves to manipulate the LRT exchange rate

A malicious operator can undelegate itself from the EigenLayer delegation manager, which removes its EigenPod shares and causes the LRT exchange rate to drop sharply. This can leave ETH/LST stuck and unable to be claimed by the Rio Delegator Approver contract.

g Follow with giraffe, hash and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-02-rio-network-core-protocol-judging/issues/53

Found by

g, giraffe, hash, mstpr-brainbot, zzykxx

Summary

If a malicious operator undelegates itself in EigenLayer delegation manager contract, the exchange rate of LRT can significantly decrease, and ETH/LST can become stuck, unable to be claimed by the Rio Delegator Approver contract.

Vulnerability Detail

Operators' delegator contracts delegate their balance to the operators. Operators can "undelegate" themselves from any delegation forwarded to them by triggering this function: DelegationManager.sol#L211-L258.

If the operator undelegate the delegator approver, then according to the strategy, there can be two things that happen:

1- Strategy shares: When the operator undelegates, the strategy shares delegated to the operator will be queued for withdrawal to the stakee address. In this case, the staker is the RIO operator delegator contract, which has no implementation to withdraw the queued withdrawal request since the withdrawer must be the "msg.sender." Therefore, the operator delegator must implement that functionality in such cases. The only downside to this is that the accounting of strategy shares to operators is tracked internally and not relied upon the StrategyManager's actual shares in the EigenLayer contract.

2- EigenPod shares: When EigenPod shares are undelegate, the EigenPod shares are removed. Unlike the strategy shares, the EigenPod shares are used to account for how much ETH is held by each operator. If an operator undelegate, then the entire EigenPod balance will be "0," and the RIO contracts are not prepared for this. This will erase a large amount of ETH TVL held by the Beacon Chain strategy, hence the LRT token exchange rate will change dramatically. Also, as with the above strategy shares issue, the staker is the operator delegator; hence, the operator delegator must implement the withdrawal functionality to be able to withdraw the ETH balance from the EigenPod.

Impact

High because of the "EigenPod shares" issue can unexpectedly decrease the TVL, leading to a decrease in the LRT exchange rate without warning which would affect the deposits/withdrawals of the LRT in different assets aswell.

Coded PoC:

Solidity
// forge test --match-contract RioLRTOperatorRegistryTest --match-test test_UndelegateRemovesEigenPodShares -vv
    function test_UndelegateRemovesEigenPodShares() public {
        uint8 operatorId =
            addOperatorDelegator(reETH.operatorRegistry, address(reETH.rewardDistributor), emptyStrategyShareCaps, 10);
        
        // @review make a deposit
        reETH.coordinator.depositETH{value: 32 * 5 ether}();

        // Push funds into EigenLayer.
        vm.prank(EOA, EOA);
        reETH.coordinator.rebalance(ETH_ADDRESS);

        // Verify validator withdrawal credentials.
        uint40[] memory validatorIndices = verifyCredentialsForValidators(reETH.operatorRegistry, operatorId, 5);

        // @review get the addresses 
        address operatorDelegator = reETH.operatorRegistry.getOperatorDetails(operatorId).delegator;
        RioLRTOperatorDelegator delegatorContract = RioLRTOperatorDelegator(payable(operatorDelegator));

        // @review all ether is in eigen pod shares 
        assertEq(uint256(delegatorContract.getEigenPodShares()), 32 * 5 * 1e18);
        // @review the TVL is the 32*5 ether and the initial deposit
        assertEq(reETH.assetRegistry.getTVLForAsset(ETH_ADDRESS), 160010000000000000000);

        // @review undelegate from the operator 
        vm.prank(address(uint160(0 + 1)));
        delegationManager.undelegate(operatorDelegator);

        // @review eigenpod shares are removed fully
        assertEq(uint256(delegatorContract.getEigenPodShares()), 0);
        // @review the TVL is only the initial deposit
        assertEq(reETH.assetRegistry.getTVLForAsset(ETH_ADDRESS), 10000000000000000);
    }

Code Snippet

https://github.com/Layr-Labs/eigenlayer-contracts/blob/6de01c6c16d6df44af15f0b06809dc160eac0ebf/src/contracts/core/DelegationManager.sol#L211-L258

Tool used

Manual Review

Recommendation

Discussion

solimander

Valid, but feels like it should be medium given precondition that you must be voted into the active operator set.

nevillehuang

Since operators are not trusted in the context of rio-protocol, I believe high severity to be appropriate since this allows direct manipulation of exchange rates and can cause stuck funds within rio contracts

sherlock-admin4

The protocol team fixed this issue in the following PRs/commits: https://github.com/rio-org/rio-sherlock-audit/pull/15

10xhash

The protocol team fixed this issue in the following PRs/commits: rio-org/rio-sherlock-audit#15

Pausing functionality is added to reduce the impact. Operators are currently trusted wrt the undelegate functionality and further improvements will be made in upcoming versions

sherlock-admin4

The Lead Senior Watson signed off on the fix.

The original report as published on Sherlock, by g. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the protocol did not account for operators undelegating themselves, which zeroes out EigenPod shares and breaks the exchange rate calculation.

Impact

The LRT exchange rate can unexpectedly decrease, affecting deposits and withdrawals, and funds may become stuck.

What the attacker needed

Operator must be in active set; operator acts maliciously

The fix

The protocol team added pausing functionality to reduce the impact, but operators are still trusted with respect to undelegation and further improvements are planned.

How it was found

  1. Deposit ETH into the protocol and rebalance to push funds into EigenLayer.
  2. Verify validator withdrawal credentials for the operator.
  3. Call undelegate on the operator delegator contract.
  4. Observe that EigenPod shares become zero and TVL drops to only the initial deposit.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In this system, operators are trusted to hold funds on behalf of users. An operator can call a function to remove itself from the delegation, which makes the system think the funds it held are gone. This makes the token representing those funds lose value and can trap other funds.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by g

View all

23 more disclosed reports, best first.

More from Rio Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.