-
Notifications
You must be signed in to change notification settings - Fork 7
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
Delegated votes are locked when owner lock is expired #268
Comments
141345 marked the issue as primary issue |
141345 marked the issue as duplicate of #223 |
141345 marked the issue as duplicate of #112 |
alcueca marked the issue as duplicate of #82 |
alcueca changed the severity to 2 (Med Risk) |
alcueca marked the issue as satisfactory |
141345 marked the issue as not a duplicate |
1 similar comment
141345 marked the issue as not a duplicate |
141345 marked the issue as duplicate of #211 |
alcueca marked the issue as selected for report |
alcueca changed the severity to 3 (High Risk) |
This vulnerability, if not found, would have meant that some users would have permanently lost assets in the for of voting power. While at that point the application owners would certainly warn users to not let their locks expire without undelegating, many users would not get the warning, as it is not that easy to make sure that every user is aware of something. The result is that time and again, users would get their tokens locked forever. |
Lines of code
https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L331
https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L371-L374
https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L383
Vulnerability details
Impact
In
delegate()
of VoteEscrow.sol, a user is able to delegate their locked votes to someone else, and undelegate (i.e. delegate back to themselves). When the user tries to re-delegate, either to someone else or themselves, the lock must not be expired. This is problematic because if a user forgets and lets their lock become expired, they cannot undelegate. This blocks withdrawal, which means their tokens are essentially locked forever.Proof of Concept
To exit the system, Alice must call
withdraw()
. However, since they've delegated, they will not be able to.To re-delegate to themselves (undelegate), they call
delegate(alice.address)
. However, there is a check to see iftoLocked.end
has expired, which would be true since it would point to Alice's lock.This is a test to be added into VoteEscrow.t.sol. It can be manually run by executing
forge test --match-test testUnSuccessUnDelegate
.Tools Used
Manual
Recommended Mitigation Steps
Consider refactoring the code to skip
toLocked.end > block.timestamp
if undelegating. For example, adding a small delay (e.g., 1 second) to the lock end time when a user undelegates.Assessed type
Timing
The text was updated successfully, but these errors were encountered: