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.
DoS Vulnerability in the deposit Function of BribeRewarder contract
Summary
The deposit function in BribeRewarder always reverts due to a logical error.
This function is intended to be called by the voter contract when a user votes.
However, the _modify function, which is called within deposit, checks if the msg.sender is the owner of the tokenID.
Since the msg.sender is actually the voter contract and not the user, this check fails, causing the deposit function to revert and preventing the user from voting.
Vulnerability Detail
The deposit function includes the onlyVoter modifier, which ensures the msg.sender is the voter contract.
Inside the deposit function, the _modify function is called.
The _modify function checks if the msg.sender is the owner of the tokenID.
As the msg.sender is the voter contract (and not the actual user), this check fails, causing the deposit function to revert.
sherlock-admin4
changed the title
Proud Coral Terrier - DoS Vulnerability in the deposit Function of BribeRewarder contract
blackhole - DoS Vulnerability in the deposit Function of BribeRewarder contract
Jul 29, 2024
blackhole
High
DoS Vulnerability in the
deposit
Function ofBribeRewarder
contractSummary
The
deposit
function inBribeRewarder
always reverts due to a logical error.This function is intended to be called by the voter contract when a user votes.
However, the
_modify
function, which is called withindeposit
, checks if themsg.sender
is theowner
of thetokenID
.Since the
msg.sender
is actually the voter contract and not the user, this check fails, causing thedeposit
function to revert and preventing the user from voting.Vulnerability Detail
The
deposit
function includes theonlyVoter
modifier, which ensures themsg.sender
is the voter contract.Inside the
deposit
function, the_modify
function is called.The
_modify
function checks if themsg.sender
is the owner of thetokenID
.As the
msg.sender
is the voter contract (and not the actual user), this check fails, causing thedeposit
function to revert.https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/BribeRewarder.sol#L143-L147
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/BribeRewarder.sol#L260
Impact
Due to this issue, users are unable to vote,
BribeRewarder
contract cannot be used.Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/BribeRewarder.sol#L144
Tool used
Manual Review
Recommendation
Update the
_modify
function to allow both the owner of the tokenID and the voter contract to use it.Duplicate of #39
The text was updated successfully, but these errors were encountered: