The upgradeTier
function in the MembershipFactory contract lacks proper access control mechanisms. While it checks for the DAO type (SPONSORED), it fails to verify that the caller is the actual owner of the NFTs being upgraded. This allows any address to potentially initiate upgrades for NFTs they don't own.
The mentioned SPONSORED
check-in upgradeTier
function indeed restricts upgrades to DAOs with a SPONSORED type. However, this check alone does not control who can perform the upgrade; it only restricts the type of DAO that is eligible for an upgrade.
This requirement confirms only that the DAO type is SPONSORED
, meaning it's a valid target for upgrades. However, it does not ensure that:
The caller (_msgSender()
) owns the NFT of the tier being upgraded.
The caller has specific permission to perform this upgrade action.
To ensure only authorized users can perform the upgrade, you need additional checks that confirm ownership or permission for the caller:
Ownership Verification: Confirm that _msgSender()
it holds the necessary tier of the NFT within the DAO.
This ensures that only the holder of at least two tokens fromTierIndex
is eligible to call the upgrade.
Caller Verification: In addition to ownership, you may want to ensure that _msgSender()
is the only one who can perform this action for their own NFT, preventing others from upgrading on their behalf.
Unauthorized addresses can attempt to upgrade NFTs they don't own
Potential confusion and gas waste from failed unauthorized attempts
No proper audit trail of who initiated the upgrade
Lack of flexibility for authorized operators or approved addresses
Manual Review
Here's an example that includes both the SPONSORED
type check and ownership verification:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.