SystemConfig::updateReferrerInfo
Updates _referrer
Info Instead of Caller'sThe updateReferrerInfo
function is utilized by users to set or update their referrals. However, a critical bug causes the _referrer
's referralInfo
mapping to be updated instead of the caller's (msg.sender
). Consequently, the referral system fails entirely, with everyone's referrer being set to themselves.
Upon execution, the function mistakenly loads the referralInfoMap
of the _referrer
instead of msg.sender
. Subsequently, the values are set accordingly, leading to incorrect updates in the referral system.
This bug renders the referral system ineffective, preventing users from correctly setting their referrers. Additionally, it allows anyone to change another user's referrer to themselves by simply invoking this function once.
The following test demonstrates the failure of the referral system due to this bug. It attempts to update a user
's referral to user1
but fails to change the referrer. Moreover, it incorrectly sets user1
's referral to themselves.
Manual Review
To correct this issue, the function should load the referralInfoMap
using msg.sender
instead of _referrer
. The corrected version of the function is as follows:
This correction ensures that the referral information is correctly updated for the caller (msg.sender
), restoring the functionality of the referral system as intended.
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.