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

User can quick vote and withdraw their vote #123

Closed
code423n4 opened this issue Aug 9, 2023 · 5 comments
Closed

User can quick vote and withdraw their vote #123

code423n4 opened this issue Aug 9, 2023 · 5 comments
Labels
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 duplicate-77 edited-by-warden unsatisfactory does not satisfy C4 submission criteria; not eligible for awards

Comments

@code423n4
Copy link
Contributor

code423n4 commented Aug 9, 2023

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/GaugeController.sol#L211-L278

Vulnerability details

Impact

There's nothing which stops user to vote with his max power/weight on a gauge and then withdraw the vote. After withdrawing, his max power/weight can be re-used to vote on another gauge.

Proof of Concept

User can vote for multiple gauges till the sum of his assigned weights do not exceed 10 000:

 power_used = power_used + new_slope.power - old_slope.power;
 require(power_used >= 0 && power_used <= 10_000, "Used too much power");

The power_used calculation takes into the consideration the old vote. Thus user can decrease their vote. E.g. if user votes for gauge with weight 10, and then votes for the same gauge with weight 4, the weight will be updated to 4, and the power used will be decreased to 4.
This behavior allows user to put his all voting power (10 000) on a single gauge, then remove it and right afterwards reuse it again (10 000) on another vote.

Tools Used

Manual code review

Recommended Mitigation Steps

Do not allow to decrease assigned weight to gauge

Assessed type

Other

@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 Aug 9, 2023
code423n4 added a commit that referenced this issue Aug 9, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #45

@c4-pre-sort
Copy link

141345 marked the issue as not a duplicate

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #77

@alcueca
Copy link

alcueca commented Aug 24, 2023

See #77

@c4-judge
Copy link

alcueca marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge added unsatisfactory does not satisfy C4 submission criteria; not eligible for awards duplicate-45 duplicate-77 and removed duplicate-77 duplicate-45 labels Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 duplicate-77 edited-by-warden unsatisfactory does not satisfy C4 submission criteria; not eligible for awards
Projects
None yet
Development

No branches or pull requests

4 participants