Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: high
Valid

`SystemConfig::updateReferrerInfo` let the user auto Referrer itself

Summary

The SystemConfig::updateReferrerInfo function lacks proper asignation, enabling users to either set themselves as their own referrer or update other users' referrer information without authorization.

Vulnerability Details

The SystemConfig::updateReferrerInfo function is meant to update a user's referral information. However, the current implementation allows users to set themselves as their own referrer or modify the referral information of other users, which should not be permitted.

ReferralInfo storage referralInfo = referralInfoMap[_referrer]; // <== ISSUE HERE
referralInfo.referrer = _referrer;
referralInfo.referrerRate = _referrerRate;
referralInfo.authorityRate = _authorityRate;

This implementation allows users to update the referral information tied to the _referrer address, rather than the address of the user making the request (msg.sender). As a result, a user can set themselves as their own referrer or change the referral details of other users.

Although there is a check to prevent a user from setting themselves as their referrer:

if (_msgSender() == _referrer) {
revert InvalidReferrer(_referrer);
}

This check is ineffective because users can still modify the referral information of other users, including setting their own address as the referrer.

/// Error when the referrer and the referee cannot be the same person
error InvalidReferrer(address referrer);

Impact

Users can bypass restrictions and set themselves as their own referrer and can unauthorizedly update the referrer information of other users

Tools Used

  • Manual Code Review

Recommendations

Update the updateReferrerInfo function:

+ ReferralInfo storage referralInfo = referralInfoMap[mgs.sender];
- ReferralInfo storage referralInfo = referralInfoMap[_referrer];
referralInfo.referrer = _referrer;
referralInfo.referrerRate = _referrerRate;
referralInfo.authorityRate = _authorityRate;
Updates

Lead Judging Commences

0xnevi Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-SystemConfig-updateReferrerInfo-msgSender

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

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.