Endorsed votes by a user do not decrease after the user’s votes are revoked
When a user's votes are revoked, their previously recorded endorsements for a proposal are not reduced. This can make a proposal appear to have more support than it actually does, making it more likely to be activated.
Submitted by rbserver
https://github.com/code-423n4/2022-08-olympus/blob/main/src/policies/VoterRegistration.sol#L53-L56 https://github.com/code-423n4/2022-08-olympus/blob/main/src/policies/Governance.sol#L180-L201
The voter admin can call the following revokeVotesFrom function to revoke a user’s votes, which also decreases the total supply of the votes, after the user endorses a proposal through calling the endorseProposal function below. Because endorseProposal can be called multiple times, the user has the incentive to call it for endorsing the proposal again with the new votes minted by the issueVotesTo function. However, after the user’s votes are revoked, the user has no incentive to call endorseProposal again. Hence, the endorsed votes by the user for the proposal does not decrease after the user’s votes are revoked. When determining whether the proposal can be activated or not, its old endorsed votes, which is not decreased, are compared against the new total supply of the votes, which is decreased because of the revokeVotesFrom call. As a result, the proposal is unreliably more likely to satisfy the condition for being activated.
https://github.com/code-423n4/2022-08-olympus/blob/main/src/policies/VoterRegistration.sol#L53-L56
function revokeVotesFrom(address wallet_, uint256 amount_) external onlyRole("voter_admin") {
// Revoke the votes in the VOTES module
VOTES.burnFrom(wallet_, amount_);
}
https://github.com/code-423n4/2022-08-olympus/blob/main/src/policies/Governance.sol#L180-L201
function endorseProposal(uint256 proposalId_) external {
uint256 userVotes = VOTES.balanceOf(msg.sender);
if (proposalId_ == 0) {
revert CannotEndorseNullProposal();
}
Instruction[] memory instructions = INSTR.getInstructions(proposalId_);
if (instructions.length == 0) {
revert CannotEndorseInvalidProposal();
}
// undo any previous endorsement the user made on these instructions
uint256 previousEndorsement = userEndorsementsForProposal[proposalId_][msg.sender];
totalEndorsementsForProposal[proposalId_] -= previousEndorsement;
// reapply user endorsements with most up-to-date votes
userEndorsementsForProposal[proposalId_][msg.sender] = userVotes;
totalEndorsementsForProposal[proposalId_] += userVotes;
emit ProposalEndorsed(proposalId_, msg.sender, userVotes);
}
Proof of Concept
Please append the following test in src\test\policies\Governance.t.sol. This test will pass to demonstrate the described scenario.
function testScenario_EndorsedVotesDoNotDecreaseAfterVotesAreRevoked() public {
_submitProposal();
// voter3 endorse the proposal
vm.prank(voter3);
governance.endorseProposal(1);
assertEq(governance.userEndorsementsForProposal(1, voter3), 300);
assertEq(governance.totalEndorsementsForProposal(1), 300);
// to simulate calling VoterRegistration.revokeVotesFrom that burns voter3's votes, VOTES.burnFrom is called by godmode here
vm.prank(godmode);
VOTES.burnFrom(voter3, 300);
// at this moment, voter3 has 0 votes
assertEq(VOTES.balanceOf(voter3), 0);
// however, the proposal is still endorsed with voter3's previous votes
assertEq(governance.userEndorsementsForProposal(1, voter3), 300);
assertEq(governance.totalEndorsementsForProposal(1), 300);
}
Tools Used
VSCode
Recommended Mitigation Steps
When revokeVotesFrom is called during the time for endorsement, the corresponding votes that are previously endorsed for a proposal and are now revoked should be removed from the proposal’s endorsed votes for the user. This ensures that the endorsed votes and the votes’ total supply after the revocation are in sync for the proposal.
fullyallocated (Olympus) acknowledged and commented:
This is true, and I appreciate the throughness of the explanation—it’s hard to adjust endorsements based on the user’s balance because there’s no events/callbacks in solidity. We plan to use a staking vault where tokens are transfer locked and there’s a warmup period + cooldown period to mitigate this issue.
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 endorsement total is only updated when a user calls endorseProposal again, so revoking votes does not automatically adjust existing endorsements.
Impact
A proposal could be activated with less genuine support than intended, because its endorsement count is not reduced when votes are revoked.
What the attacker needed
Voter admin revokes a user's votes; user had previously endorsed a proposal
The fix
The system should remove or adjust a user's endorsements when their votes are revoked, for example by tracking endorsements per proposal and updating them on revocation.
How it was found
- A user endorses a proposal, recording their current vote balance as their endorsement.
- The voter admin revokes the user's votes, reducing the total vote supply.
- The user does not call endorseProposal again, so their previous endorsement remains counted.
- The proposal's endorsement total stays higher than the actual votes backing it, making activation easier.
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, users can endorse proposals with their voting power. If an admin later removes a user's voting power, the endorsement they already made stays counted. This means a proposal could look more popular than it really is.
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.