#37251 [SC-Critical] Fraudulent padding of governance voting power
Submitted on Nov 30th 2024 at 02:15:23 UTC by @innertia for Audit Comp | Celo
Report ID: #37251
Report Type: Smart Contract
Report severity: Critical
Target: https://github.com/celo-org/celo-monorepo/blob/release/core-contracts/12/packages/protocol/contracts/governance/LockedGold.sol
Impacts:
Manipulation of governance voting result deviating from voted outcome and resulting in a direct change from intended effect of original results
Description
Brief/Intro
Slash
reduces or increases a user's nonvoting balance
. However, there is no processing related to delegete
.
This can cause various vulnerabilities, but this report will introduce the fraudulent inflation of voting rights by attackers.
Vulnerability Details
The slash
function increases or decreases the nonvotingBalance
of the target account or reporter. However, if a delegation has occurred beforehand, the increase or decrease of the delegation amount must also be calculated.
https://github.com/celo-org/celo-monorepo/blob/3c58a09455a12518916d2df38693325bafeb462b/packages/protocol/contracts/governance/LockedGold.sol#L505-L506
For example, if you look at the lock
function, which is another process that increases nonvotingBalance
, you can see that it also updates DelegatedAmount
.
https://github.com/celo-org/celo-monorepo/blob/3c58a09455a12518916d2df38693325bafeb462b/packages/protocol/contracts/governance/LockedGold.sol#L150-L151
slash
does not do this, so there is no consistency between the increase/decrease in nonvotingBalance
and DelegatedAmount
. This can lead to various attack methods and calculation errors, but I would like to introduce one example, which is inflating the number of voting rights.
I will explain the step-by-step process while implementing it within the POC.
Impact Details
Inflating the number of votes
Withdrawing tokens while maintaining the number of votes etc.
References
https://github.com/celo-org/celo-monorepo/blob/3c58a09455a12518916d2df38693325bafeb462b/packages/protocol/contracts/governance/LockedGold.sol#L505-L506. https://github.com/celo-org/celo-monorepo/blob/3c58a09455a12518916d2df38693325bafeb462b/packages/protocol/contracts/governance/LockedGold.sol#L150-L151
Proof of Concept
3. Proof of Concept
Please add the following test_GovernanceVotingPowerFraudulentlyInflated
function to the LockedGoldTest_slash
contract in LockedGold.t.sol
. https://github.com/celo-org/celo-monorepo/blob/release/core-contracts/12/packages/protocol/test-sol/unit/governance/voting/LockedGold.t.sol.
https://github.com/celo-org/celo-monorepo/blob/3c58a09455a12518916d2df38693325bafeb462b/packages/protocol/test-sol/unit/governance/voting/LockedGold.t.sol#L1096C10-L1096C30
Was this helpful?