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.
_notifyBribes() will revert everytime because of wrong check in BribeRewarder::_modify()
Summary
The deposit() which is called in _notifyBribes() will revert because when the deposit() in BribeRewarder.sol calls the _modify() it will check if the msg.sender is owner of the nft position. This check will not pass because the msg.sender is the Voter contract, not the owner of the nft
Vulnerability Detail
This is where the deposit() from BribeRewarder.sol is called
function _notifyBribes(
uint256periodId,
addresspool,
uint256tokenId,
uint256deltaAmount
) private {
>> IBribeRewarder[] storage rewarders = _bribesPerPriod[periodId][pool];
for (uint256 i =0; i < rewarders.length; ++i) {
if (address(rewarders[i]) !=address(0)) {
>> rewarders[i].deposit(periodId, tokenId, deltaAmount);
_userBribesPerPeriod[periodId][tokenId].push(rewarders[i]);
}
}
}
When we call it like this the msg.sender in it will be the Voter contract, then inside this deposit() function we call the _modify() that has a check if the owner of this tokenId is calling the function
sherlock-admin4
changed the title
Big Violet Bee - _notifyBribes() will revert everytime because of wrong check in BribeRewarder::_modify()
DPS - _notifyBribes() will revert everytime because of wrong check in BribeRewarder::_modify()Jul 29, 2024
DPS
High
_notifyBribes()
will revert everytime because of wrong check inBribeRewarder::_modify()
Summary
The
deposit()
which is called in_notifyBribes()
will revert because when thedeposit()
inBribeRewarder.sol
calls the_modify()
it will check if themsg.sender
is owner of the nft position. This check will not pass because themsg.sender
is theVoter
contract, not the owner of the nftVulnerability Detail
This is where the
deposit()
fromBribeRewarder.sol
is calledWhen we call it like this the
msg.sender
in it will be theVoter
contract, then inside thisdeposit()
function we call the_modify()
that has a check if the owner of thistokenId
is calling the functionThis will revert because the
Voter
contract is not owner of the nftImpact
High because
_notifyBribes
will revert everytimeCode Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/Voter.sol#L221
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/BribeRewarder.sol#L143
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/rewarders/BribeRewarder.sol#L264
Tool used
Manual Review
Recommendation
In the
_modify()
functionBribeRewarder.sol
check if themsg.sender
is theVoter
contract, if it is just proceed with the transactionDuplicate of #39
The text was updated successfully, but these errors were encountered: