Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10**6 is too small for RATIO_BASE #40

Closed
code423n4 opened this issue Mar 6, 2023 · 3 comments
Closed

10**6 is too small for RATIO_BASE #40

code423n4 opened this issue Mar 6, 2023 · 3 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue edited-by-warden grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

code423n4 commented Mar 6, 2023

Lines of code

https://github.com/code-423n4/2023-03-aragon/blob/4db573870aa4e1f40a3381cdd4ec006222e471fe/packages/contracts/src/plugins/utils/Ratio.sol#L6

Vulnerability details

Impact

RATIO_BASE is set as 10**6, and limit of participations is also around 10**6.
RATIO_BASE should be bigger than square of the limit of participations.

Proof of Concept

Currently, RATIO_BASE is set as 10**6.
https://github.com/code-423n4/2023-03-aragon/blob/4db573870aa4e1f40a3381cdd4ec006222e471fe/packages/contracts/src/plugins/utils/Ratio.sol#L6

In the contract MajorityVotingBase, we can easily guess that the limit of participations is around 10**6 (= RATIO_BASE).
https://github.com/code-423n4/2023-03-aragon/blob/4db573870aa4e1f40a3381cdd4ec006222e471fe/packages/contracts/src/plugins/governance/majority-voting/MajorityVotingBase.sol#L536

For example, let's say that the creator of Voting DAO wants to separate 1/2001 and 1/2002 in the voting ratio.
In other words, "1 yes, 2000 no" is executable and "1 yes, 2001 no" is non-excutable.
So voting ratio should be bigger than 1/2002 and smaller than 1/2001.
Since both 1/2001 and 1/2002 are inside the range (499/1000000, 500/1000000), there is no proper ratio.

Tools Used

(Nothing, just looking the code on VSCode)

Recommended Mitigation Steps

We can set RATIO_BASE as 10**12. Then, the creator can separate every two different fractions with denominators less than 10**6.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Mar 6, 2023
code423n4 added a commit that referenced this issue Mar 6, 2023
@code423n4 code423n4 changed the title 10**6 is too small for RATIO_BASE 10**6 is too small for RATIO_BASE Mar 6, 2023
@0xean
Copy link

0xean commented Mar 12, 2023

The same is true for any value that is selected for RATIO_BASE, its a design choice about how much precision is required and therefore best as QA

@c4-judge c4-judge added downgraded by judge Judge downgraded the risk level of this issue QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Mar 12, 2023
@c4-judge
Copy link

0xean changed the severity to QA (Quality Assurance)

@c4-judge
Copy link

0xean marked the issue as grade-c

@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue edited-by-warden grade-c QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants