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.
User can vote twice once the lock duration elapses
Summary
The Voter contract allows users to vote for pools using their staked position's tokenId from the MlumStaking contract, ensuring the position meets minimum lock duration requirements. Once a vote is cast, the position is marked to prevent multiple votes in the same period. However, if the lock duration elapses, users can withdraw their funds, create a new position, and vote again, enabling an exploit where a user can vote twice.
It is recommended to prevent users from voting twice by verifying the startLockTime of the position and ensuring it was not opened within the current period.
sherlock-admin4
changed the title
Blunt Carmine Camel - User can vote twice once the lock duration elapses
web3pwn - User can vote twice once the lock duration elapses
Jul 29, 2024
web3pwn
High
User can vote twice once the lock duration elapses
Summary
The
Voter
contract allows users to vote for pools using their staked position'stokenId
from theMlumStaking
contract, ensuring the position meets minimum lock duration requirements. Once a vote is cast, the position is marked to prevent multiple votes in the same period. However, if the lock duration elapses, users can withdraw their funds, create a new position, and vote again, enabling an exploit where a user can vote twice.Vulnerability Detail
The vote functions of the
Voter
contract allow users to vote for specified pools using thetokenId
of their staked position in theMlumStaking
contract. The function checks if the position'sinitialLockDuration
meets the minimum requirements of_minimumLockTime
and ensures that the position'slockDuration
is at least equal to_periodDuration
. Once a user votes, the_hasVotedInPeriod
mapping is updated to mark that the position has voted in the current period, preventing multiple votes with the same position. The issue arises when the lock duration of the position elapses, allowing the user to withdraw all funds from the position. An attacker could exploit this by voting, withdrawing from the position, creating a new position, and voting again, thereby voting twice.Issue Scenario:
10
.tokenId 10
, marking it as having already voted in_hasVotedInPeriod
.tokenId 10
.tokenId 11
.tokenId 11
.Impact
A user can vote twice every
lockDuration
by voting, withdrawing from the position, creating a new position, and voting again.Code Snippet
Tool used
Manual Review
Recommendation
It is recommended to prevent users from voting twice by verifying the
startLockTime
of the position and ensuring it was not opened within the current period.Duplicate of #166
The text was updated successfully, but these errors were encountered: