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

By increasing his lock time, a user who was delegated votes to by other users can lock the deposits for the other users for 5 more years #230

Closed
code423n4 opened this issue Aug 10, 2023 · 9 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-182 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) upgraded by judge Original issue severity upgraded from QA/Gas by judge

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L390-L409

Vulnerability details

Impact

The delegatee of a user decides how long the deposits of the user are locked

Proof of Concept

When calling delegate, users can only delegate their votes to an new address that has a longer or equal locktime than the old one.

require(toLocked.end >= fromLocked.end, "Only delegate to longer lock");

This means that if a user wants to get his votes back from an address he delegated to (current delegate), his lock time must be longer than the log time of the current delegate.

This means that if the current delegatee increases his lock time, the user who wants to delegate his votes back to himself needs to make his locktime bigger than the locktime of the current delegate.
Since the deposit can only be withdrawn when the locktime has been passed, the current delegatee indirectly increases the locktime of all users that have delegated votes to him.

Tools Used

Manual review

Recommended Mitigation Steps

Make it possible for a user to get back his voting power without the need to increase his lock time by checking if msg.sender wants to delegate his voting power to himself.

The locking effect can also be mitigated by reducing the variable LOCKTIME to e.g. 1 year. This would make the impact of being forced to increase the own lock time to be able to withdraw the own deposit smaller.

Assessed type

Governance

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Aug 10, 2023
code423n4 added a commit that referenced this issue Aug 10, 2023
@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #116

@c4-pre-sort
Copy link

141345 marked the issue as duplicate of #82

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Aug 24, 2023
@c4-judge
Copy link

alcueca changed the severity to 2 (Med Risk)

@c4-judge c4-judge added duplicate-411 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) and removed duplicate-82 labels Aug 24, 2023
@c4-judge
Copy link

alcueca marked the issue as partial-50

@c4-pre-sort c4-pre-sort reopened this Aug 24, 2023
@c4-pre-sort c4-pre-sort removed partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) duplicate-411 labels Aug 24, 2023
@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 #375

@c4-judge c4-judge added the partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) label Aug 24, 2023
@c4-judge
Copy link

alcueca marked the issue as partial-50

@c4-judge
Copy link

alcueca marked the issue as duplicate of #182

@c4-judge c4-judge added duplicate-182 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue labels Aug 29, 2023
@c4-judge
Copy link

alcueca changed the severity to 3 (High Risk)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-182 partial-50 Incomplete articulation of vulnerability; eligible for partial credit only (50%) upgraded by judge Original issue severity upgraded from QA/Gas by judge
Projects
None yet
Development

No branches or pull requests

3 participants