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.
BribeRewarder_modify() uses incorrect parameter to check tokenId owner
Summary
The BribeRewarder._modify() check uses the incorrect parameter of msg.sender to check the tokenId owner.
if (!IVoter(_caller).ownerOf(tokenId, msg.sender)) {
revertBribeRewarder__NotOwner();
}
Vulnerability Detail
The flow is Voter.vote() -> Voter._notifyBribes() -> rewarders[i].deposit() -> rewarders[i].modify(), hence msg.sender is the _caller contract, not the actual voter. Can verify this because of the onlyVoter() check as well.
Reentrants
High
BribeRewarder_modify()
uses incorrect parameter to checktokenId
ownerSummary
The
BribeRewarder._modify()
check uses the incorrect parameter ofmsg.sender
to check thetokenId
owner.Vulnerability Detail
The flow is
Voter.vote() -> Voter._notifyBribes() -> rewarders[i].deposit() -> rewarders[i].modify()
, hencemsg.sender
is the_caller
contract, not the actual voter. Can verify this because of theonlyVoter()
check as well.POC
The setup can be found in the gist.
https://gist.github.com/Reentrants/50898e49155a13b9eddbe69ea52c1a19#file-e2etest-t-sol-L175-L191
For brevity, the case is linked below.
Impact
Users will not be able to vote.
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/7fd1a65b76d50f1bf2555c699ef06cde2b646674/magicsea-staking/src/rewarders/BribeRewarder.sol#L264-L266
Tool used
Manual Review
Recommendation
_modify()
needs to take in the caller ofvote()
for verification.Duplicate of #39
The text was updated successfully, but these errors were encountered: