OlympusGovernance: Users can prevent their votes from being revoked
A user can prevent their votes from being revoked by the voter_admin by storing them in the OlympusGovernance contract via the vote and reclaimVotes functions. This allows the user to retain voting power even after the admin attempts to revoke it.
Submitted by cccz, also found by zzzitron
In the VoterRegistration contract, voter_admin can call the revokeVotesFrom function to revoke the user’s votes.
function revokeVotesFrom(address wallet_, uint256 amount_) external onlyRole("voter_admin") {
// Revoke the votes in the VOTES module
VOTES.burnFrom(wallet_, amount_);
}
But there is a way for users to prevent their votes from being revoked by voteradmin. In the OlympusGovernance contract, the user can call the vote function to vote for the activeProposal, and then call the reclaimVotes function to reclaim his votes. When the vote function is called, VOTES are sent to the OlympusGovernance contract and recorded using the userVotesForProposal variable. When the reclaimVotes function is called, the VOTES recorded in the userVotesForProposal variable are sent back to the user. This means that the user can store his VOTES tokens in userVotesForProposal. The revokeVotesFrom function cannot revoke the VOTES tokens recorded in userVotesForProposal and the reclaimVotes function can only be called by the user himself. If the user calls the reclaimVotes function and vote function in one transaction, then his VOTES token balance will always be 0 (thus avoiding revocation of votes by voteradmin) and he will be able to vote.
Proof of Concept
https://github.com/code-423n4/2022-08-olympus/blob/2a0b515012b4a40076f6eac487f7816aafb8724a/src/policies/Governance.sol#L240-L262 https://github.com/code-423n4/2022-08-olympus/blob/2a0b515012b4a40076f6eac487f7816aafb8724a/src/policies/Governance.sol#L295-L313 https://github.com/code-423n4/2022-08-olympus/blob/2a0b515012b4a40076f6eac487f7816aafb8724a/src/policies/VoterRegistration.sol#L53-L56
Recommended Mitigation Steps
Consider allowing to call the reclaimVotes function to reclaim any user’s vote, thus avoiding the user storing his VOTES tokens in userVotesForProposal
function reclaimVotes(uint256 proposalId_, address user_) external {
uint256 userVotes = userVotesForProposal[proposalId_][user_];
if (userVotes == 0) {
revert CannotReclaimZeroVotes();
}
if (proposalId_ == activeProposal.proposalId) {
revert CannotReclaimTokensForActiveVote();
}
if (tokenClaimsForProposal[proposalId_][user_] == true) {
revert VotingTokensAlreadyReclaimed();
}
tokenClaimsForProposal[proposalId_][user_] = true;
VOTES.transferFrom(address(this), user_, userVotes);
}
fullyallocated (Olympus) acknowledged and commented:
This is true, we don’t expect to use the voter admin in production, just to issue votes during internal testing period.
0xean (judge) decreased severity to Medium and commented:
Downgrading to M severity as this does not lead to direct loss of user funds, but does highlight an issue with current contracts.
Consider the following scenarios. There are currently three users, A, B and C, in the system.
- voter_admin minted 100 VOTEs for each of these three users
- After a period of time, due to system upgrade or other reasons, the VOTEs of the users need to be revoked.
- voter_admin revokes the VOTEs of users A and B respectively, but user C uses this vulnerability to prevent his VOTE from being revoked.
- At this time, user C has all the VOTEs, and he can execute any proposal.
Okay, at this point I still believe a Medium issue, voter_admin as a mitigation could reissue votes to User A and B. Additionally User C will eventually have to reclaim these votes in order to vote on the next proposal. I am going to stick with Medium on this one. Appreciate the additional clarity.
@0xean - You are right, thanks for your attention.
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 revokeVotesFrom function only burns tokens from the user's wallet, not tokens stored in the governance contract, and reclaimVotes can only be called by the user, so the admin cannot force a reclaim.
Impact
A user could prevent their votes from being revoked, potentially allowing them to retain voting power and execute proposals if they hold a majority.
What the attacker needed
User has VOTES tokens; voter_admin attempts to revoke
The fix
The reclaimVotes function should be callable by anyone to reclaim any user's votes, preventing users from storing tokens in the contract.
How it was found
- User calls vote function to vote for activeProposal, sending VOTES to the governance contract.
- User calls reclaimVotes function to reclaim votes, but if done in same transaction as vote, balance stays zero.
- voter_admin attempts to revoke votes but cannot revoke tokens stored in userVotesForProposal.
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, an admin can take back voting tokens from users. But a user found a way to hide their tokens inside the voting contract so the admin cannot take them back. This means the user keeps their voting power even when the admin tries to remove it.
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.