In MembershipFactory.sol::MembershipFactory
, the function MembershipFactory::upgradeTier
is intended to allow users to upgrade their tier within a sponsored DAO. However, this function currently burns 2 DAOMembership
tokens rather than 1. Was this intentional? To properly facilitate the upgrade, the protocol should only burn one token and perhaps charge a fee for the tier upgrade.
A user in a sponsored DAO attempts to upgrade their tier.
The user calls the upgradeTier
function.
The user has minted only 1 token in the current tier (fromTierIndex
).
The upgradeTier
call fails due to insufficient token balance, causing an under/overflow error.
Consider the following test case that serves as a proof of concept:
Convert the project to a Foundry-based structure.
Install all necessary dependencies.
Configure remappings as needed.
Create a file named MembershipERC1155Test.sol
in the test
folder.
Add the following code to MembershipERC1155Test.sol
:
Create a mock
directory in the test
folder.
Inside mock
, add the files CurrencyMock.sol
and OWPWalletMock.sol
.
Implement the required mock contracts within these files.
Open a terminal and run the following command to execute the test:
Review the test logs:
The test successfully passes, confirming the oversight.
Users attempting to upgrade their tier in the DAO would require a balance of at least 2 DAO tokens.
If a user only has 1 token in the current tier, they would encounter a DoS vulnerability due to an under/overflow when attempting to burn tokens they do not possess.
Manual Review, Foundry
To resolve this issue,
The protocol should burn only one token during a tier upgrade and consider implementing a fee mechanism for the tier upgrade process if needed.
If it's intentional then Please implement a check that should revert if users have less than 2 tokens or if they're not eligible to upgrade.
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.