All operators can have ETH deposits regardless of the cap setted for them leading to miscalculated TVL
The protocol's TVL calculation loops over all operators, including those not actively participating in the beacon chain strategy, so an operator without a cap can still have ETH deposits counted. This can cause the TVL to be overstated, leading to failed withdrawals because the calculated ether does not exist in the active set.
hash Follow with klaus, mstpr-brainbot and 2 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-02-rio-network-core-protocol-judging/issues/235
The protocol has acknowledged this issue.
Found by
hash, klaus, mstpr-brainbot, neumo, zzykxx
Summary
Some operators might not be eligible for using some strategies in the LRT's underlying tokens. However, in default every operator can have ETH deposits which would impact the TVL/Exchange rate of the LRT regardless of they have a cap or not.
Vulnerability Detail
First, let's examine how an operator can have ETH deposit
An operator can have ETH deposits by simply staking in beacon chain, to do so they are not mandatory to call EigenPods "stake" function. They can do it separately without calling the EigenPods stake function.
Also, every operator delegator contract can call verifyWithdrawalCredentials to increase EigenPod shares and decrease the queued ETH regardless of they are active operator or they have a cap determined for BEACON_CHAIN_STRATEGY.
Now, let's look at how the TVL of ETH (BEACON_CHAIN_STRATEGY) is calculated in the AssetRegistry:
function getTVLForAsset(address asset) public view returns (uint256) {
uint256 balance = getTotalBalanceForAsset(asset);
if (asset == ETH_ADDRESS) {
return balance;
}
return convertToUnitOfAccountFromAsset(asset, balance);
}
function getTotalBalanceForAsset(address asset) public view returns (uint256) {
if (!isSupportedAsset(asset)) revert ASSET_NOT_SUPPORTED(asset);
address depositPool_ = address(depositPool());
if (asset == ETH_ADDRESS) {
return depositPool_.balance + getETHBalanceInEigenLayer();
}
uint256 sharesHeld = getAssetSharesHeld(asset);
uint256 tokensInRio = IERC20(asset).balanceOf(depositPool_);
uint256 tokensInEigenLayer = convertFromSharesToAsset(getAssetStrategy(asset), sharesHeld);
return tokensInRio + tokensInEigenLayer;
}
function getETHBalanceInEigenLayer() public view returns (uint256 balance) {
balance = ethBalanceInUnverifiedValidators;
IRioLRTOperatorRegistry operatorRegistry_ = operatorRegistry();
-> uint8 endAtID = operatorRegistry_.operatorCount() + 1; // Operator IDs start at 1.
-> for (uint8 id = 1; id < endAtID; ++id) {
-> balance += operatorDelegator(operatorRegistry_, id).getETHUnderManagement();
}
}
As we can see above, regardless of the operators cap the entire active validator counts are looped.
function getEigenPodShares() public view returns (int256) {
return eigenPodManager.podOwnerShares(address(this));
}
function getETHQueuedForWithdrawal() public view returns (uint256) {
uint256 ethQueuedSlotData;
assembly {
ethQueuedSlotData := sload(ethQueuedForUserSettlementGwei.slot)
}
uint64 userSettlementGwei = uint64(ethQueuedSlotData);
uint64 operatorExitAndScrapeGwei = uint64(ethQueuedSlotData >> 64);
return (userSettlementGwei + operatorExitAndScrapeGwei).toWei();
}
function getETHUnderManagement() external view returns (uint256) {
int256 aum = getEigenPodShares() + int256(getETHQueuedForWithdrawal());
if (aum < 0) return 0;
return uint256(aum);
}
Since the operator has eigen pod shares, the TVL will account it aswell. However, since the operator is not actively participating on ether deposits (not in the heap order) the withdrawals or deposits to this specific operator is impossible. Hence, the TVL is accounting an operators eigen pod share which the contract assumes that it is not in the heap.
Textual PoC: Assume there are 5 operators whereas only 4 of these operators are actively participating in BEACON_CHAIN_STRATEGY which means that 1 operator has no validator caps set hence, it is not in the heap order. However, this operator can still have ether deposits and can verify them. Since the TVL accounting loops over all the operators but not the operators that are actively participating in beacon chain strategy, the TVL calculated will be wrong.
Impact
Miscalculation of total ether holdings of an LRT. Withdrawals can fail because the calculated ether is not existed in the heap but the TVL says there are ether to withdraw from the LRT.
Code Snippet
Tool used
Manual Review
Recommendation
put a check on verifyWithdrawalCredentials that is not possible to call the function if the operator is not actively participating in the BEACON_CHAIN_STRATEGY.
Discussion
solimander
This is a necessary feature, and should be a short-lived quirk. If an operator is deactivated prior to all validator withdrawal credentials being proven, they will need to prove the credentials and withdraw after deactivation, which would then be scraped back into the deposit pool.
nevillehuang
I believe this should have been a known consideration stated in the contest details, so leaving as medium severity.
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 TVL calculation iterates over all operators without checking whether each operator is actively participating in the beacon chain strategy and has a cap.
Impact
The TVL of the LRT can be miscalculated, which may cause withdrawals to fail because the reported ether is not actually available in the active operator set.
What the attacker needed
Operator not in beacon chain strategy; operator can receive ETH deposits
The fix
The recommendation is to add a check in verifyWithdrawalCredentials so that it cannot be called if the operator is not actively participating in the BEACON_CHAIN_STRATEGY.
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.
The protocol tracks how much ETH it holds by adding up balances from all operators. But some operators are not supposed to accept ETH deposits, yet they can still receive and verify them. Because the total is calculated from every operator, the reported total can be higher than what is actually available for withdrawals.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.