-
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
Delegators can delegate to a expired or withdrawn lock #338
Comments
it's user's own behavior, leads to voting power waste. QA might be more appropriate. |
This seems to be a duplicate of #112 |
OpenCoreCH marked the issue as sponsor confirmed |
alcueca changed the severity to 2 (Med Risk) |
alcueca marked the issue as duplicate of #268 |
alcueca marked the issue as satisfactory |
alcueca marked the issue as not a duplicate |
This is not a duplicate of #112 or #268. This finding is not about the user unable to get his CANTO back. This finding is about delegates being able to have their lock end and withdraw. In this situation, the delegators are delegating to accounts that (the warden assumes) cannot vote. There is no mention of the delegator lock expiring, so I'm assuming that in this situation the delegator can undelegate normally. In this case the impact would be that between the delegate withdrawing and the delegator taking action, the delegator's voting power is wasted. If that is the case, this would be QA at best. @OpenCoreCH, please review. |
Ah yes you are right, this finding does not mention the withdrawal that does not work, but the zero voting power. Yes I think that is a QA finding. It requires specific user actions (increasing lock duration) and even if it happens, it is easily recoverable (removing the delegation, as the lock of the user is longer per definition in this case). |
alcueca changed the severity to QA (Quality Assurance) |
alcueca marked the issue as grade-b |
Lines of code
https://github.com/code-423n4/2023-08-verwa/blob/main/src/VotingEscrow.sol#L356
https://github.com/code-423n4/2023-08-verwa/blob/main/src/VotingEscrow.sol#L301
https://github.com/code-423n4/2023-08-verwa/blob/main/src/VotingEscrow.sol#L337
Vulnerability details
Impact
Users can delegate to an expired or withdrawn lock, making their voting power wasted.
Proof of Concept
In delegate(), we ensure the toLocked.end >= fromLocked.end, preventing a user to delegate on a lock that will expire before him:
However, in increaseAmount(), we increase the newLocked.end by 5 years and directly update the msg.sender's lock, not checking whether it currently delegating on another lock:
So delegators can delegate to an expired lock:
Also, in withdraw(), we allow there are delegated power left:
So users can delegate to a withdrawn lock in this situation.
PoC:
Output:
Tools Used
Manual Review
Recommended Mitigation Steps
increaseAmount() shouldn't update the sender's lock.end bigger than delegatee's lock end.
Assessed type
Governance
The text was updated successfully, but these errors were encountered: