Skip to content
Business logic Audit finding Intermediate

withdrawFees does not update checkpoint

The withdrawFees function in BondingManager updates a delegator's lastClaimRound and bondedAmount through autoClaimEarnings but never calls _checkpointBondingState, so BondingVotes retains stale checkpoint data. An attacker could exploit this inconsistency to obtain an incorrect voting power in BondingVotes.

ADM Follow with rvierdiiev, twicek and 1 other

Originally disclosed on Code4rena

Submitted by ADM, also found by rvierdiiev, twicek, and HChang26

BondingVotes may have stale data due to missing checkpoint in BondingManager#withdrawFees().

Proof of Concept

The withdrawFee function has the autoClaimEarnings modifier:

    function withdrawFees(address payable _recipient, uint256 _amount) external whenSystemNotPaused currentRoundInitialized autoClaimEarnings(msg.sender) {

which calls _autoClaimEarnings:

modifier autoClaimEarnings(address _delegator) {
        _autoClaimEarnings(_delegator);
        _;

which calls updateDelegatorWithEarnings:

function _autoClaimEarnings(address _delegator) internal {
        uint256 currentRound = roundsManager().currentRound();
        uint256 lastClaimRound = delegators[_delegator].lastClaimRound;
        if (lastClaimRound < currentRound) {
            updateDelegatorWithEarnings(_delegator, currentRound, lastClaimRound);
        }
    }

During updateDelegatorWithEarnings, both delegator.lastClaimRound and delegator.bondedAmount can be assigned new values.

        del.lastClaimRound = _endRound;
        // Rewards are bonded by default
        del.bondedAmount = currentBondedAmount;

However, during the lifecycle of all these functions, _checkpointBondingState is never called either directly or through the autoCheckpoint modifier resulting in lastClaimRound & bondedAmount’s values being stale in BondingVotes.sol.

Recommended Mitigation Steps

Add autoCheckpoint modifier to the withdrawFees function.

victorges (Livepeer) confirmed

victorges (Livepeer) mitigated:

https://github.com/livepeer/protocol/pull/623


The original report as published on Code4rena, by ADM. 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 withdrawFees function lacks the autoCheckpoint modifier, so changes to lastClaimRound and bondedAmount are not propagated to BondingVotes.

Impact

BondingVotes could hold stale checkpoint data, potentially leading to incorrect voting power calculations.

What the attacker needed

A delegator with pending earnings; ability to call withdrawFees

The fix

The withdrawFees function should be fixed by adding the autoCheckpoint modifier.

How it was found

  1. Call withdrawFees, which triggers autoClaimEarnings.
  2. autoClaimEarnings calls updateDelegatorWithEarnings, which updates lastClaimRound and bondedAmount.
  3. No checkpoint is made to BondingVotes, leaving its data stale.

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.

A smart contract keeps a record of how much each person has staked and when that was last updated. When someone withdraws fees, the staking record changes, but a separate voting contract is not told about the change, so it keeps using old numbers. This means a person's voting power could be wrong.

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 ADM

View all

1 more disclosed report, best first.

More from Livepeer Onchain Treasury Upgrade

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.