This repository has been archived by the owner on Jan 12, 2025. It is now read-only.
BribeRewarder::_modify()
the check of the ownership of the tokenId
with msg.sender
as the passed parameter will make voter::vote()
always revert
#73
Hunter
Medium
in
BribeRewarder::_modify()
the check of the ownership of thetokenId
withmsg.sender
as the passed parameter will makevoter::vote()
always revertSummary
in
BribeRewarder::_modify()
the check of the ownership of thetokenId
withmsg.sender
as the passed parameter will makevoter::vote()
always revertVulnerability Detail
in function
vote()
we call
_notifyBribes
in Line #211this function calls
rewarders
contract (BribeRewarder) so that it notifies them that the user voted for their Pool, so that the user becomes eleigble for claiming rewardsin Line #225 we call
deposit()
in (BribeRewarder) contractthe function
deposit()
hasonlyVoter
modifier so that only thevoter
contract is able to call this function which is a good thing, but we need to keep in mind that in the current instance of ofBribeRewarder
themsg.sender
is thevoter
contractNow we call
_modify
in Line #144we see in line #264 we check if
msg.sender
is the owner of thistokenId
passed by calling thevoter
contractthe problem here is that since
msg.sender
is thevoter
contract, this check will always fail (sincevoter
contract is not the owner of thetokenId
)the confusion arised from the fact that
_modify()
function is called insideclaim()
which is called by the actuall user not thevoter
contract and this check will pass then onclaim()
by usersbut this check is wrong during
deposit()
as described aboveImpact
the
vote()
invoter
contract is corrupted and will always fail and revert for anyPool
havingBribeRewarder
which will almost always be the case.MediumL breaking core contract functionality
Code Snippet
vote()
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/Voter.sol#L153-L219
_notifyBribes()
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/Voter.sol#L221-L229
deposit()
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/rewarders/BribeRewarder.sol#L143-L147
_modify()
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/rewarders/BribeRewarder.sol#L260-L298
Tool used
Manual Review
Recommendation
an easy solution would be changing the check
_modify()
totx.origin
herewith taking into considerations the tradeOff using
tx.origin
(if users of the protocol are phished, this will give the ability to attacker to claim the rewards in their behalf)but i recommend it cause it is simpler and would require less logic changes
Duplicate of #39
The text was updated successfully, but these errors were encountered: