You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
Users can double their voting power inside Voter.sol
Summary
When users call Voter.sol::vote the only thing that is registered is the id of the NFT they have used. That means that if their lock has already passed, they can withdraw their funds, create a new lock with the same funds and receive a new NFT with a new id and vote once again, essentially doubling their voting power.
Vulnerability Detail
function vote(uint256tokenId, address[] calldatapools, uint256[] calldatadeltaAmounts) external {
if (pools.length!= deltaAmounts.length) revertIVoter__InvalidLength();
// check voting startedif (!_votingStarted()) revertIVoter_VotingPeriodNotStarted();
if (_votingEnded()) revertIVoter_VotingPeriodEnded();
// check ownership of tokenIdif (_mlumStaking.ownerOf(tokenId) !=msg.sender) {
revertIVoter__NotOwner();
}
uint256 currentPeriodId = _currentVotingPeriodId;
// check if alreay voted
@>if (_hasVotedInPeriod[currentPeriodId][tokenId]) {
revertIVoter__AlreadyVoted();
}
// check if _minimumLockTime >= initialLockDuration and it is lockedif (_mlumStaking.getStakingPosition(tokenId).initialLockDuration < _minimumLockTime) {
revertIVoter__InsufficientLockTime();
}
...
The check inside Voter::vote only records the tokenId to check weather the funds have already been used to vote. By burning and minting a new NFT using MlumStaking::withdrawFromPosition and MlumStaking::createPosition the user can double their voting power using the same amount of funds.
sherlock-admin4
changed the title
Bitter Seaweed Eagle - Users can double their voting power inside Voter.sol
tedox - Users can double their voting power inside Voter.solJul 29, 2024
tedox
Medium
Users can double their voting power inside
Voter.sol
Summary
When users call
Voter.sol::vote
the only thing that is registered is the id of the NFT they have used. That means that if their lock has already passed, they can withdraw their funds, create a new lock with the same funds and receive a new NFT with a new id and vote once again, essentially doubling their voting power.Vulnerability Detail
The check inside
Voter::vote
only records the tokenId to check weather the funds have already been used to vote. By burning and minting a new NFT usingMlumStaking::withdrawFromPosition
andMlumStaking::createPosition
the user can double their voting power using the same amount of funds.Impact
POC
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L153-L219
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L354-L390
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L496-L502
Tool used
Manual Review
VS Code
Foundry
Recommendation
Do not allow NFTs created during the voting period to be used for voting.
Duplicate of #166
The text was updated successfully, but these errors were encountered: