Skip to content
Business logic Audit finding Intermediate

Governance wrongly calculates _quorumReached()

The governance contract's quorum check sums against and abstain votes instead of all votes cast, so quorum is only reached when at least a third of votes are against or abstain. This can prevent legitimate proposals with mostly for votes from passing.

T1MOH Follow with josephdara, yjrwkk and 5 others

Originally disclosed on Code4rena

Submitted by T1MOH, also found by josephdara, yjrwkk, LokiThe5th, Iurii3, squeaky_cactus, skyge, and zambody

For some reason it is calculated as sum of againstVotes and abstainVotes instead of totalVotes on proposal. As the result, quorum will be reached only if >=1/3 of all votes are abstain or against, which doesn’t make sense.

Proof of Concept

Number of votes with support = 1 and support = 2 is summed up:

    function _quorumReached(uint256 proposalId) internal view override returns (bool){
        return proposalData[proposalId].supportVotes[1] + proposalData[proposalId].supportVotes[2] >= quorum(proposalSnapshot(proposalId));
    }

However support = 1 means against votes, support = 2 means abstain votes:

https://github.com/code-423n4/2023-06-lybra/blob/26915a826c90eeb829863ec3851c3c785800594b/contracts/lybra/governance/LybraGovernance.sol#L120-L122

    function proposals(uint256 proposalId) external view returns (...) {
        ...

        forVotes =  proposalData[proposalId].supportVotes[0];
        againstVotes =  proposalData[proposalId].supportVotes[1];
        abstainVotes =  proposalData[proposalId].supportVotes[2];

        ...
    }

Tools Used

Manual review

Recommended Mitigation Steps

Use totalVotes:

    function _quorumReached(uint256 proposalId) internal view override returns (bool){
        return proposalData[proposalId].totalVotes >= quorum(proposalSnapshot(proposalId));
    }

Assessed type

Governance

LybraFinance confirmed


The original report as published on Code4rena, by T1MOH. 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

The quorum check adds the against and abstain vote counts instead of using the total votes cast.

Impact

Proposals with majority support may fail to reach quorum unless at least a third of votes are against or abstain, potentially blocking legitimate governance decisions.

What the attacker needed

None

The fix

The quorum check should use the proposal's total votes instead of summing against and abstain votes.

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, quorum is the minimum number of votes needed for a result to count. This contract mistakenly counts only the 'no' and 'abstain' votes toward that minimum, so a proposal with many 'yes' votes could still fail to reach quorum.

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 T1MOH

View all

11 more disclosed reports, best first.

More from Lybra Finance

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.