Description: Imagine trying to upgrade your membership level without checking if you've got enough tokens to cover the cost. That's basically what's happening in the upgradeTier function of the MembershipFactory contract. It's attempting to burn tokens without first verifying if the user owns the required amount, which could lead to some pretty messy situations.
Impact:
Transactions might fail mid-process
Users could end up wasting gas (and money)
It'd be a pretty poor experience for users
There's even a chance the contract's internal state could get messed up
Proof of Concept:
Recommended Mitigation:
Let's add a quick check before burning those tokens:
This fix makes sure the user has enough tokens before letting them upgrade. It's like double-checking your wallet before buying something expensive - it just makes sense! Now, if someone tries to upgrade without enough tokens, the transaction will fail early, saving everyone involved a lot of hassle.
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.