The GlobalConfigurationBranch::createCustomReferralCode
function is designed to allow the contract owner to assign a custom referral code to a specific referrer. This functionality is crucial for managing referrals within the Zaros ecosystem, enabling the tracking and rewarding of users who for example bring new participants to the platform.
But the GlobalConfigurationBranch::createCustomReferralCode
function allows for the creation of custom referral codes without implementing checks to prevent the duplication of these codes. This enables the possibility of creating multiple referral codes with identical strings, each potentially associated with different referrers.
The absence of a mechanism to enforce the uniqueness of custom referral codes during their creation process leads to a vulnerability where duplicate codes can be generated. This issue arises due to the direct assignment of a referrer to a custom referral code without prior verification of the code's existence or uniqueness.
In referral systems, each referral code typically needs to uniquely identify a single referrer to accurately track who is eligible for a reward (for example who referred new users or customers). If the same referral code is assigned to multiple individuals when a new user signs up using a shared referral code, it becomes unclear whom to attribute the referral bonus or credit to. This ambiguity leads to disputes / errors in distributing rewards, as the system cannot distinguish between the intended referrers.
In the CreateCustomReferralCode.t.sol copy and paste this test and run:
forge test --match-test test_WhenCreateCustomReferralCodeDuplicated -vv
Manual review.
Implement checks to ensure each customReferralCode
is unique within the createCustomReferralCode function.
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.