When MIN_VOTING_POWER_REQUIRED is changed, previous votes are not affected
When the minimum voting power threshold is changed, previously cast votes are not re-evaluated, so token IDs with voting power below the new threshold can still have their old votes counted. An attacker could exploit this to retain influence from spam or low-power votes after the threshold is raised.
Submitted by cccz
When MIN_VOTING_POWER_REQUIRED is changed, tokenIDs with votes lower than MIN_VOTING_POWER_REQUIRED will not be able to vote through the delegate function, but previous votes will not be affected.
Since MIN_VOTING_POWER_REQUIRED is mainly used to reduce the influence of spam users, changing this value should affect previous votes.
Proof of Concept
Recommended Mitigation Steps
In the getPriorVotes and getVotes functions, when the balance corresponding to tokenId is less than MINVOTINGPOWER_REQUIRED, the value of votes will not be increased
function getVotes(uint256 tokenId) external view returns (uint256) {
uint256[] memory delegated = _getCurrentDelegated(tokenId);
uint256 votes = 0;
for (uint256 index = 0; index < delegated.length; index++) {
+ if(this.balanceOfNFT(delegated[index]) >= MIN_VOTING_POWER_REQUIRED){
votes = votes + this.balanceOfNFT(delegated[index]);
+ }
}
return votes;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param tokenId The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(uint256 tokenId, uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, 'VEDelegation: not yet determined');
uint256[] memory delegatednft = _getPriorDelegated(tokenId, blockNumber);
uint256 votes = 0;
for (uint256 index = 0; index < delegatednft.length; index++) {
+ if(this.balanceOfAtNFT(delegatednft[index], blockNumber) >= MIN_VOTING_POWER_REQUIRED){
votes = votes + this.balanceOfAtNFT(delegatednft[index], blockNumber);
+ }
}
return votes;
}
zeroexdead (Golom) confirmed, but disagreed with severity
When calling we
getVotes()andgetPriorVotes()we’re consideringMIN_VOTING_POWER_REQUIRED. Reference: https://github.com/golom-protocol/contracts/commit/db650729b0805ec19906a0ea11de6af7a53ac382
LSDan (judge) decreased severity to Medium and commented:
Downgrading this to medium. Assets are not at direct risk.
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 vote-counting functions (getVotes and getPriorVotes) do not check the minimum voting power threshold when summing delegated balances, so the threshold only applies at the time of delegation, not to existing votes.
Impact
Previous votes from token IDs below the new minimum voting power remain counted, so the threshold change does not reduce the influence of spam users as intended; assets are not at direct risk.
What the attacker needed
MIN_VOTING_POWER_REQUIRED is changed; attacker has delegated votes below the new threshold
The fix
The getVotes and getPriorVotes functions should skip delegated balances below MIN_VOTING_POWER_REQUIRED when summing votes, and the project later added such checks.
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 voting system, a minimum amount of voting power is required to cast a vote. The report says that if the minimum is increased later, votes that were already cast by accounts below the new minimum are still counted. This means the rule change does not apply to past votes, which could let low-power accounts keep influence they should have lost.
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.