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.
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
function _requireOnlyOperatorOrOwnerOf(uint256 tokenId) internal view {
// isApprovedOrOwner: caller has no rights on token
require(ERC721Upgradeable._isAuthorized(msg.sender, msg.sender, tokenId), "FORBIDDEN");//@audit @<
}
from above code we can the first parameter of _isAuthorized is the owner of tokenID, however the protocol use msg.sender which lead to owner == spender check always return true.
/**
* @dev Check if a userAddress has privileged rights on a spNFT
*/
function _requireOnlyOperatorOrOwnerOf(uint256 tokenId) internal view {
// isApprovedOrOwner: caller has no rights on token
- require(ERC721Upgradeable._isAuthorized(msg.sender, msg.sender, tokenId), "FORBIDDEN");+ require(ERC721Upgradeable._isAuthorized(_ownerOf(tokenId), msg.sender, tokenId), "FORBIDDEN");//@audit @<
}
sherlock-admin4
changed the title
Glorious Garnet Stallion - malicious can by pass the operator or owner check
coffiasd - malicious can by pass the operator or owner check
Jul 29, 2024
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA Medium severity issue.RewardA payout will be made for this issue
coffiasd
High
malicious can by pass the operator or owner check
Summary
_requireOnlyOperatorOrOwnerOf
function usemsg.sender
instead of tokenId owner lead to malicious by pass theOnlyOperatorOrOwnerOf
check.Vulnerability Detail
from code link
OZ code
ERC721Upgradeable.sol
from above code we can the first parameter of
_isAuthorized
is the owner of tokenID, however the protocol usemsg.sender
which lead toowner == spender
check always return true.test:
Impact
malicious can by pass the operator or owner check
Code Snippet
https://github.com/sherlock-audit/2024-06-magicsea/blob/main/magicsea-staking/src/MlumStaking.sol#L140-L143
Tool used
Foundry
Manual Review
Recommendation
Duplicate of #378
The text was updated successfully, but these errors were encountered: