Skip to content
Business logic Audit finding Intermediate

ValidatorWithdrawalVault.settleFunds doesn’t check amount that user has inside NodeELRewardVault to pay for penalty

The settleFunds function in ValidatorWithdrawalVault only considers the balance of that vault when calculating a validator's earnings, ignoring rewards held in NodeELRewardVault. As a result, an operator with sufficient total earnings across both vaults could still have their SD collateral slashed if the penalty exceeds the ValidatorWithdrawalVault balance alone.

rvierdiiev Follow

Originally disclosed on Code4rena

Submitted by rvierdiiev

ValidatorWithdrawalVault.settleFunds doesn’t check amount that user has inside NodeELRewardVault to pay for penalty. That value can increase operator’s earned amount, which can avoid slashing.

Proof of Concept

When a validator withdraws from beacon chain the ValidatorWithdrawalVault.settleFunds function is called. This function calculates amount that a validator has earned for attestations as a validator. So only the balance of this contract is considered.

The function fetches penalty amount. This penalty amount contains of 3 points: _mevTheftPenalty, _missedAttestationPenalty and _missedAttestationPenalty.

In this case, if the penalty amount is bigger than the validator’s earning on ValidatorWithdrawalVault, the SD collateral is slashed.

Now, we need to understand how validator receives funds in this system. All attestation payments come to ValidatorWithdrawalVault, while mev/block proposal funds are coming to SocializingPool or NodeELRewardVault (depends on user’s choice). So actually, _missedAttestationPenalty is responding to ValidatorWithdrawalVault earning, while _mevTheftPenalty is responding to NodeELRewardVault earnings.

That means, NodeELRewardVault balance should also be checked in order to find out how many earnings a validator has and they should be also counted when applying the penalty.

Simple example:

  1. A validator wants to exit.
  2. An operator earning is 0.1 eth inside ValidatorWithdrawalVault.
  3. The accrued penalty is 0.11, which means the user will be slashed.
  4. The operator also has NodeELRewardVault where their operator’s reward is 0.05 eth.
  5. As result, the user has enough balance to cover penalty, but they were still penalized.

Tools Used

VsCode

Recommended Mitigation Steps

As you accrue _mevTheftPenalty inside ValidatorWithdrawalVault, you also should calculate the operator’s rewards inside NodeELRewardVault.

Assessed type

Error

manoj9april (Stader) acknowledged and commented:

Rewards are treated separately between CL and EL. We will take this suggestion into account for next upgrades.

Picodes (judge) commented:

Keeping medium severity as this report shows how an operator could be slashed, despite having earned more than the penalty if we combine EL and CL rewards, which could lead to a loss of funds.


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

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 settleFunds function only reads the balance of ValidatorWithdrawalVault and does not include the balance of NodeELRewardVault when determining whether the validator's earnings cover the penalty.

Impact

An operator could be slashed (lose SD collateral) despite having earned enough across both vaults to cover the penalty, leading to a loss of funds.

What the attacker needed

Validator exits; penalty exceeds ValidatorWithdrawalVault balance; operator has rewards in NodeELRewardVault

The fix

The settleFunds function should also calculate the operator's rewards inside NodeELRewardVault when applying the penalty.

How it was found

  1. A validator wants to exit.
  2. An operator earning is 0.1 eth inside ValidatorWithdrawalVault.
  3. The accrued penalty is 0.11, which means the user will be slashed.
  4. The operator also has NodeELRewardVault where their operator’s reward is 0.05 eth.
  5. As result, the user has enough balance to cover penalty, but they were still penalized.

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.

When a validator exits, the system checks if they earned enough to cover any penalties. But it only looks at one pot of money (ValidatorWithdrawalVault) and forgets about another pot (NodeELRewardVault) where some rewards are kept. So even if the validator has enough money overall, they might still lose their collateral because the check is incomplete.

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.

More by rvierdiiev

View all

72 more disclosed reports, best first.

More from Stader Labs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.