Skip to content
Business logic Audit finding Advanced

Fully slashed transcoder can vote with 0 weight messing up the voting calculations

A fully slashed transcoder can still vote with zero weight, and when a delegator later tries to override that vote, the system subtracts the delegator's weight from other voters, potentially reverting the transaction and blocking the delegator from voting.

Vagner Follow with ladboy233

Originally disclosed on Code4rena

Submitted by Vagner (1, 2), also found by ladboy233

If a transcoder gets slashed fully he can still vote with 0 amount of weight making any other delegated user that wants to change his vote to subtract their weight amount from other delegators/transcoders.

Proof of Concept

In BondingManager.sol any transcoder can gets slashed by a specific percentage, and that specific transcoder gets resigned and that specific percentage gets deducted from his bondedAmount. https://github.com/code-423n4/2023-08-livepeer/blob/a3d801fa4690119b6f96aeb5508e58d752bda5bc/contracts/bonding/BondingManager.sol#L394-L411

If any bondedAmount will remain then the penalty will also gets subtracted from the delegatedAmount, if not, nothing happens. https://github.com/code-423n4/2023-08-livepeer/blob/a3d801fa4690119b6f96aeb5508e58d752bda5bc/contracts/bonding/BondingManager.sol#L412-L417

After that the penalty gets burned and the fees gets paid to the finder, if that is the case. https://github.com/code-423n4/2023-08-livepeer/blob/a3d801fa4690119b6f96aeb5508e58d752bda5bc/contracts/bonding/BondingManager.sol#L420-L440

The problem relies in the fact that a fully slashed transcoder, even if it gets resigned, he is still seen as an active transcoder in the case of voting. Let’s assume this case:

Recommended Mitigation Steps

If a transcoder gets fully slashed and resigned, delete his address from delegateAddress so he will not appear as a transcoder in the mechanism of counting the votes. If he still wants to participate in the system he can act as a delegator to another transcoder. Another solution would be to not let 0 weight votes happen, since they don’t modify the vote state at all.

Assessed type

Governance

victorges (Livepeer) confirmed and commented:

Slashing is turned off in the protocol, so this specific issue is not that important. It did point towards an issue in BondingVotes though in the way that the getBondingState function checks if transcoder is a transcoder or not and defaults to 0 when bondedAmount is 0. There are other ways that this logic can be triggered (not through slashTranscoder) that can show inconsistencies as well, so I’m flagging this as valid for the underlying issue that it hints to, even though it does not describe a realistic scenario about how this issue could happen.

hickuphh3 (judge) commented:

I found the POC hard to follow. A coded instance would have tremendously helped, but what I gather is:

  • fully slashed transcoder that votes will do so with 0 weight.
  • any delegator that delegated their votes to this specific transcoder intending to change their vote may face an issue with sub overflow because _handleVoteOverrides() uses the slashed transcoder’s bondedAmount instead of the 0 weight. so this issue seems valid, although its premise is that the slashing functionality is in place.

The README did not indicate that slashing was turned off, though I see it’s mentioned a couple of times in the Discord channel. Should’ve been added in the “Known caveats / limitations” section.

Hence, IMO it isn’t entirely fair to wardens if I invalidate their issue because they weren’t aware of this fact.

Leaning towards a downgrade to M because of the external requirement of the active slashing mechanism, but am open to discussion.

hickuphh3 (judge) decreased severity to Medium

hickuphh3 (judge) commented:

Revisiting this issue, IMO it’s unreasonable to expect the sponsor to explicitly list out all the gotchas / limitations of the protocol. Some will only pop into mind through discussions with wardens, which seemed to be the case here when the slashing deprecation was mentioned a couple of times in the Discord channel.

On the flip side, the fact remains that the slashing mechanism is part of the audit scope, and was counted towards the sLOC, plus the points I raised above. There wasn’t an indication in the code that slashing had been deprecated.

It’s a difficult decision here, considering the different parties’ POV. There could be some wardens who didn’t submit issues related to slashing because of what was brought up in the Discord channel, and those that did (as one can see referenced above) because they didn’t monitor the channel.

victorges (Livepeer) mitigated:

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


The original report as published on Code4rena, by Vagner. 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 slashing function does not clear the transcoder's delegate address, so the voting logic still treats them as a transcoder and uses their zero bonded amount in override calculations.

Impact

A delegator may be unable to change their vote, and the vote counting could be manipulated, but the report notes that slashing is turned off in the protocol, limiting the practical impact.

What the attacker needed

Slashing mechanism active; transcoder fully slashed; transcoder votes with zero weight; delegator attempts to override vote

The fix

The issue was mitigated by a pull request, and the report recommends clearing the transcoder's delegate address upon full slashing or preventing zero-weight votes.

How it was found

  1. A transcoder is fully slashed, reducing their bonded amount to zero but leaving their delegated amount unchanged.
  2. The slashed transcoder votes on a proposal, which is recorded with zero weight.
  3. A delegator who delegated to that transcoder tries to override the vote.
  4. The override logic subtracts the delegator's weight from the transcoder's previous vote, which had zero weight, potentially causing an underflow and reverting the transaction.

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, people can delegate their voting power to a 'transcoder' (a node operator). If that transcoder is punished ('slashed') and loses all their own stake, they can still cast a vote, but it counts as zero. Later, when a delegator tries to change their vote, the system mistakenly subtracts the delegator's weight from other people's votes, which can cause an error and stop the delegator from voting.

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 Vagner

View all

7 more disclosed reports, 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.