-
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
RE-DELEGATE AND UNDELEGATE CAN BE FRONT RUN IN VotinEscrow.sol #264
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
141345 marked the issue as duplicate of #116 |
141345 marked the issue as duplicate of #82 |
alcueca changed the severity to 2 (Med Risk) |
alcueca marked the issue as partial-50 |
141345 marked the issue as not a duplicate |
141345 marked the issue as duplicate of #375 |
alcueca marked the issue as partial-50 |
alcueca marked the issue as duplicate of #182 |
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
Lines of code
https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L390
Vulnerability details
Impact
User can not undelegate or redelegate is a malicius delegatee front run the user transaction increasing his amount of time to end calling increaseAmount.
Proof of Concept
We can explore this analyzing both functions:
https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L390C1-L409C6
This function require that old delegatee end be less than the new delegatee.
Now analyse the increaseAmount function:
https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L288C5-L324C1
This function is increasing the time of the end by 5 years, so if a delegatee see in the mempool that he is gonna be undelegate or re delegate, he can front run that transaction calling increaseAmount passing 1 wei and increasing his end for 5 years more breaking the require(toLocked.end >= fromLocked.end, "Only delegate to longer lock") in delegate function.
Tools Used
manual
Recommended Mitigation Steps
One recomendation is follow what FIAT DAO is doing in his VotingEscrow contract,
other approach that the project can take is eliminate the increasing of the time end when user call increasAmount, there is not incentive to the user to call that function if he is gonna lock for 5 years more
Assessed type
Other
The text was updated successfully, but these errors were encountered: