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.
The vote function does not work in case there is BribeRewarder assigned to the pool
Summary
The vote function reverts when a BribeRewarder is assigned due to an incorrect ownership check in its deposit function. This check, intended for the claim function where users claim rewards, incorrectly verifies ownership when called by the Voter contract during voting.
Vulnerability Detail
The vote function does not work when a BribeRewarder is assigned to the pool due to an incorrect check in the BribeRewarder contract. The deposit function of BribeRewarder is called by the Voter while voting. The issue is that the _modify function checks if the msg.sender is the owner of the tokenId. This logic is correct for the claim function where the user claims rewards and is the owner of the tokenId, but not for the deposit function where the msg.sender is the Voter contract.
Issue Scenario:
There is a pool to vote for.
The BribeRewarder was added to provide bribes for the pool.
The user tries to vote for the pool.
The call always reverts because the Voter calls the deposit function of BribeRewarder, which triggers _modify to check if the msg.sender is the owner of tokenId.
This is incorrect since the msg.sender is the Voter contract in this context.
Impact
It not possible to vote for any pools that have BribeRewarder assigned (core functionality of the protocol).
sherlock-admin4
changed the title
Blunt Carmine Camel - The vote function does not work in case there is BribeRewarder assigned to the pool
web3pwn - The vote function does not work in case there is BribeRewarder assigned to the pool
Jul 29, 2024
web3pwn
High
The
vote
function does not work in case there isBribeRewarder
assigned to the poolSummary
The
vote
function reverts when aBribeRewarder
is assigned due to an incorrect ownership check in itsdeposit
function. This check, intended for theclaim
function where users claim rewards, incorrectly verifies ownership when called by theVoter
contract during voting.Vulnerability Detail
The
vote
function does not work when aBribeRewarder
is assigned to the pool due to an incorrect check in theBribeRewarder
contract. Thedeposit
function ofBribeRewarder
is called by the Voter while voting. The issue is that the_modify
function checks if themsg.sender
is the owner of thetokenId
. This logic is correct for theclaim
function where the user claims rewards and is the owner of thetokenId
, but not for thedeposit
function where themsg.sender
is theVoter
contract.Issue Scenario:
BribeRewarder
was added to provide bribes for the pool.BribeRewarder
, which triggers_modify
to check if the msg.sender is the owner of tokenId.msg.sender
is the Voter contract in this context.Impact
It not possible to vote for any pools that have
BribeRewarder
assigned (core functionality of the protocol).Code Snippet
Tool used
Manual Review
Recommendation
It is recommended to update the
deposit
logic to ensure it is possible to correctly vote for the pools.Duplicate of #39
The text was updated successfully, but these errors were encountered: