In the MembershipFactory
contract's upgradeTier
function, attempts to upgrade from tier 0 (the highest tier) result in silent arithmetic underflow reverts rather than meaningful error messages. While not a security vulnerability due to Solidity 0.8.x's built-in overflow protection, this creates a poor user experience and could complicate contract interaction.
The vulnerability exists in the upgradeTier
function where top-tier membership upgrades are handled:
First, the tier system uses an inverse numbering scheme where tier 0 represents the highest tier level. While this is a common pattern, the function's error handling doesn't explicitly account for this design choice in its validation steps.
Second, while the function includes a check to ensure a higher tier exists (noOfTiers >= fromTierIndex + 1), it doesn't explicitly validate whether the current tier is upgradeable. Instead, it relies on Solidity's arithmetic underflow protection when attempting to calculate the target tier (fromTierIndex - 1).
Third, when a member at tier 0 attempts to upgrade, rather than receiving a clear error message explaining that they're already at the highest tier, they receive a generic panic error due to arithmetic underflow. This creates confusion and a poor user experience, especially for contract integrations that may not handle panic errors gracefully.
Proof of Concept:
Members attempting to upgrade from the highest tier receive cryptic panic errors instead of clear explanations. This creates confusion and may lead to support issues. External contracts or dApps interacting with the membership system need special handling for panic errors, which are less standard than require-based reverts. This could lead to integration challenges or broken user interfaces.
Manual Review
Ensure that the index is greater than 0:
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.