In the SystemConfig::updateReferrerInfo function, the referralInfoMap is mistakenly updated for the _referrer instead of the _msgSender(). This allows anyone to modify the referralInfo for other users, which results in several issues:
Anyone can modify another user’s referralInfoMap.
When a user tries to update his own referralInfo, the update is ineffective.
If a _referrer later uses PreMarkets::createTaker, the referrerReferralBonus could be wrongly attributed to himself, leading to incorrect self-referral bonuses.
In the SystemConfig::updateReferrerInfo function, the following code incorrectly updates the referralInfoMap:
This causes the referralInfoMap to be incorrectly updated for _referrer, not _msgSender(). This becomes problematic when referralInfoMap is later queried in PreMarkets::createTaker:
The assignment and usage of referralInfoMap is actually inconsistent:
- User A could set referralInfoMap info for User B, and he can't set it for himself.
- When User A calls createTaker, referralInfoMap[A] is queried instead of referralInfoMap[B].
This inconsistency causes several problems:
Anyone can modify the referralInfoMap for any other user.
Updates by users to their own referral information are ineffective.
If _referrer uses PreMarkets::createTaker, the referral bonus could wrongly go to himself, creating an invalid self-referral scenario.
This issue could have a Medium to High impact:
Anyone can modify the referralInfoMap for any other user.
Updates by users to their own referral information are ineffective.
If _referrer uses PreMarkets::createTaker, the referral bonus could wrongly go to himself, creating an invalid self-referral scenario.
Manual, VSCode
To resolve this issue, modify the updateReferrerInfo function so that it updates referralInfoMap for _msgSender() instead of _referrer. This will ensure that users can only update their own referral info and prevent the issues described above. Otherwise, refactor how the ReferralInfo is being used.
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.