Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

0xpranav - Voter can still vote even if remaining lock period is less then epoch period. #176

Closed
sherlock-admin4 opened this issue Jul 15, 2024 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A High severity issue. Reward A payout will be made for this issue

Comments

@sherlock-admin4
Copy link

sherlock-admin4 commented Jul 15, 2024

0xpranav

Medium

Voter can still vote even if remaining lock period is less then epoch period.

Summary

User(Voter) can still vote even if the remaining lock period of staking position is less then epoch period.

Vulnerability Detail

In docs, it is stated that the voter needs to have overall lock period greater then 90 days and the remaining lock period is greater then epoch period(_period duration)see here:https://docs.magicsea.finance/protocol/magic/magic-lum-voting.
In voter.sol , line https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L175 checks for remaining lock period less then the epoch period. But the _mlumStaking.getStakingPosition(tokenId).lockDuration will return lock duration rather the remaining period as it does not store the remaining lock duration.
See here:https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L378

Impact

As a result , user will bypass the check even if the remaining lock period is less then epoch period. Can break functions which assume vote position is locked until epoch period.

Code Snippet

https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L175

Tool used

Manual Review

Recommendation

Create a getter function of remainingLock period of staking position.

Duplicate of #166

@github-actions github-actions bot added duplicate High A High severity issue. labels Jul 21, 2024
@sherlock-admin3 sherlock-admin3 added the Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label label Jul 22, 2024
@sherlock-admin4 sherlock-admin4 changed the title Cheerful Chocolate Dolphin - Voter can still vote even if remaining lock period is less then epoch period. 0xpranav - Voter can still vote even if remaining lock period is less then epoch period. Jul 29, 2024
@sherlock-admin4 sherlock-admin4 added the Reward A payout will be made for this issue label Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A High severity issue. Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

2 participants