This submission assumes the referral system is functioning as intended. See my two other submission titled:
_authorityRate can't be set, breaking intended usage of referral system
updateReferrerInfo() incorrectly sets address in referralInfoMap to referrer instead of referree
In SystemConfig.sol, the function updateReferrerInfo() is set to external and updates ReferralInfo in the referralInfoMap mapping.
The only permissions in this function is that the caller can't be the _referrer:
Since anyone can call this function except the referrer, a malicious referree can call updateReferrerInfo() and set the _referralRate to 0 and the _authorityRate to the max allowed, effectively allowing the referree to steal the referral bonus associated with any of their future trades from the referrer.
The referral system has two different referral bonuses:
1) referralRate: a % of the platform fee given to the referrer
2) authorityRate: a % of the platform fee given to the referree
For sake of example, the max of the sum of these 2 rates together can be 30%. So if referralRate is 30%, authorityRate has to be 0%. If referralRate is 20%, authorityRate can be 10%.
A malicious user (the referree) can get referred by a referrer, using their referral code or link.
The malicious user can call updateReferrerInfo() setting the _referrerRate to 0 and the _authorityRate to the max (e.g. 30%). Now any trades the referree makes, they'll receive the entire 30% referral bonus and the referrer will get nothing.
Loss of funds for the referrer and breaks the integrity of the referral system
Manual Review
The referral system needs to be completely rewrriten, but for this submission, make sure the referree can't update the either the _referralRate or the _authorityRate.
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.