By delegating to a non-transcoder, a delegator can reduce the tally of someone else’s vote choice without first granting them any voting power
A delegate could subtract their own voting weight from another delegate's vote tally even when the other delegate was not a transcoder, because the code did not check whether the delegate was a transcoder before adjusting the tally. This allowed a malicious delegator to effectively double their voting power or manipulate governance by reducing the tally of a vote choice they opposed.
Submitted by Banditx0x
A delegate can subtract their own voting weight from the voting choice of another delegate, even if that user isn’t a transcoder. Since they are not a transcoder, they don’t have their votes initially increased by the amount delegated to them, voting weight is still subtracted from the tally of their vote choice.
Maliciously, this could be used to effectively double one’s voting power, by delegating their votes to a delegator who is about to vote for the choice which they don’t want. It can also occur accidentally, for example when somebody delegates to a transcoder who later switches role to delegate.
Proof of Concept
When a user is not a transcoder, their votes are determined by the amount they have delegated to the delegatedAddress, and does not increase when a user delegates to them:
if (bond.bondedAmount == 0) {
amount = 0;
} else if (isTranscoder) {
amount = bond.delegatedAmount;
} else {
amount = delegatorCumulativeStakeAt(bond, _round);
}
}
Let’s say that this delegator (Alice) has 100 votes and votes For, then another delegator(Bob) has delegated 1000 votes to Alice. As stated above, Alice doesn’t get the voting power of Bob’s 1000 votes, so the For count increases by 100.
Bob now votes, and _handleVotesOverrides is called. In this function, the first conditional, if isTranscoder will return false as Bob is not self-delegating.
Then, there is a check that the address Bob has delegated to has voted. Note that there is a missing check of whether the delegate address is a transcoder. Therefore the logic inside if (delegateVoter.hasVoted) is executed:
if (delegateVoter.hasVoted) {
// this is a delegator overriding its delegated transcoder vote,
// we need to update the current totals to move the weight of
// the delegator vote to the right outcome.
VoteType delegateSupport = delegateVoter.support;
if (delegateSupport == VoteType.Against) {
_tally.againstVotes -= _weight;
} else if (delegateSupport == VoteType.For) {
_tally.forVotes -= _weight;
} else {
assert(delegateSupport == VoteType.Abstain);
_tally.abstainVotes -= _weight;
}
}
The logic reduces the tally of whatever choice Alice voted for by Bob’s weight. Alice initially voted For with 100 votes, and then the For votes is reduced by Bob’s 1000 votes. Lets say that Bob votes Against. This will result in an aggregate 900 vote reduction in the For tally and +1000 votes for Agaisnt after Alice and Bob has finished voting.
If Alice was a transcoder, Bob will be simply reversing the votes they had delegated to Alice. However since Alice was a delegate, they never gained the voting power that was delegated to her.
Bob has effectively gained the ability to vote against somebody else’s votes (without first actually increasing their voting power since they are not a transcoder) and can vote themselves, which allows them to manipulate governance.
Recommended Mitigation Steps
There should be a check that a delegate is a transcoder before subtracting the tally. Here is some pseudocode:
if (delegateVoter.hasVoted && ---delegate is transcoder ---)
This is an edit of the conditional of the function _handleOverrides. This ensures that the subtraction of vote tally is only performed when the delegate is a voter AND the delegate is a transcoder. This should fix the accounting/subtraction issue of vote tally for non-transcoder delegates.
Assessed type
Invalid Validation
victorges (Livepeer) confirmed
victorges (Livepeer) mitigated:
https://github.com/livepeer/protocol/pull/625 https://github.com/livepeer/protocol/pull/626
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 missing check that the delegate is a transcoder before subtracting the delegate's weight from the tally.
Impact
A malicious delegator could effectively double their voting power or manipulate governance by reducing the tally of a vote choice they oppose, without first increasing their own voting power.
What the attacker needed
A delegator with voting weight; a non-transcoder delegate who has voted; the delegator votes after the delegate
The fix
The code should check that the delegate is a transcoder before subtracting the tally, as was done in the mitigation.
How it was found
- Alice, a non-transcoder delegator, has 100 votes and votes For.
- Bob delegates 1000 votes to Alice, but Alice's voting power does not increase because she is not a transcoder.
- Bob votes Against, triggering _handleVotesOverrides.
- The code sees that Alice has voted and subtracts Bob's weight from the For tally, even though Alice is not a transcoder.
- The For tally is reduced by 1000 and the Against tally is increased by 1000, giving Bob extra influence.
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 a voting system, when someone delegates their votes to another person, the system should only adjust the vote counts if that other person is a special type of voter called a transcoder. Here, the system forgot to check that, so a delegator could remove votes from someone else's tally without having added any votes to that person first. This let them unfairly influence the vote outcome.
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.