ERC20ConvictionScore ’s governanceDelta should be subtracted when user is not a governor anymore
When a user loses governor status, the governance score delta is added as a positive value instead of being subtracted, so the total governance score becomes incorrect. This can inflate or deflate total votes, potentially allowing anyone to pass proposals or preventing quorum.
FairSide contest
Originally disclosed on Code4rena
The TOTAL_GOVERNANCE_SCORE is supposed to track the sum of the credit scores of all governors.
In ERC20ConvictionScore._updateConvictionScore, when the user does not fulfill the governance criteria anymore and is therefore removed, the governanceDelta should be negative, but it’s positive.
isGovernance[user] = false;
governanceDelta = getPriorConvictionScore(
user,
block.number - 1
);
It then gets added to the new total:
uint224 totalGCSNew =
add224(
totalGCSOld,
governanceDelta,
"ERC20ConvictionScore::_updateConvictionTotals: conviction score amount overflows"
);
The TOTAL_GOVERNANCE_SCORE tracks wrong data leading to issues throughout all contracts like wrong FairSideDAO.totalVotes data, which can then be used by anyone to pass proposals in the worst case.
Or totalVotes can be arbitrarily inflated and break the voting mechanism as no proposals can reach the quorum (percentage of totalVotes) anymore.
Recommend returning a negative signed integer for this case and adding it to the new total.
fairside-core (FairSide) confirmed:
Fixed in PR#14.
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
Impact
The total governance score becomes incorrect, which can lead to wrong total votes and potentially allow anyone to pass proposals or prevent quorum.
What the attacker needed
User loses governor status
The fix
The code was fixed to return a negative signed integer for this case and add it to the new total.
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.
A smart contract keeps a running total of voting power. When someone stops being a governor, their score should be removed from that total. Instead, the code adds their score again, making the total wrong. This can let anyone pass proposals or stop any proposal from passing.
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.