The `updateReferrerInfo` function in SystemConfig.sol allows updating the referrer and authority rates. However, it lacks a check to ensure that the _authorityRate meets a minimum threshold. This oversight allows users to set the _authorityRate to 0 and allocate the entire rate to _referrerRate, which can lead to unfair distribution of referral rewards.
Assume the following values:
baseReferralRate = 3000
(30%)
referralExtraRateMap[_referrer] = 2000
(20%)
REFERRAL_RATE_DECIMAL_SCALER = 1,000,000
A user calls the function with:
_referrer = 0x123...abc
_referrerRate = 5000
(50%)
_authorityRate = 0
(0%)
Caller Check:
The caller is not _referrer
, so the function proceeds.
Zero Address Check:
_referrer
is a valid address, so the function proceeds.
Referrer Rate Check:
_referrerRate
(5000) is not less than baseReferralRate
(3000), so the function proceeds.
Calculate Total Rate:
referralExtraRate
for _referrer
is 2000.
totalRate = baseReferralRate + referralExtraRate = 3000 + 2000 = 5000
.
Total Rate Check:
totalRate
(5000) is not greater than REFERRAL_RATE_DECIMAL_SCALER
(1,000,000), so the function proceeds.
Rate Sum Check:
_referrerRate + _authorityRate = 5000 + 0 = 5000
.
This equals totalRate
(5000), so the function proceeds.
Update Referrer Info:
The function updates referralInfoMap[_referrer]
with the new rates.
It emits an UpdateReferrerInfo
event.
In this scenario, the _authorityRate is set to 0, allowing the entire rate to be allocated to _referrerRate. This can lead to unfair distribution of rewards and potential exploitation of the referral system.
Introduce a baseAuthorityRate and add a check to ensure that _authorityRate is not below this minimum threshold.
Valid high severity. There are two impacts here due to the wrong setting of the `refferalInfoMap` mapping. 1. Wrong refferal info is always set, so the refferal will always be delegated to the refferer address instead of the caller 2. Anybody can arbitrarily change the referrer and referrer rate of any user, resulting in gaming of the refferal system I prefer #1500 description the most, be cause it seems to be the only issue although without a poc to fully describe all of the possible impacts
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.