Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: high
Valid

Unauthorized Referral Setting Vulnerability in SystemConfig::updateReferrerInfo Function

Summary

The updateReferrerInfo function is designed to allow users to set their referral information within the system. However, a critical security flaw has been identified: any user can set or modify referral information for other users, as there is no check in place to ensure that only the rightful owner can set their own referral. This vulnerability can lead to unauthorized manipulation of referral data, resulting in potential financial losses, exploitation, and trust issues within the platform.

Vulnerability Details

The updateReferrerInfo function lacks a mechanism to verify that the user attempting to update the referral information is the actual owner of the account in question. This oversight allows any user to set or modify the referral information for any other user on the platform.

The absence of ownership checks opens the door for various forms of exploitation. Malicious users could systematically alter the referral information of multiple accounts, rerouting rewards and causing widespread disruption within the referral system.

// Lack of access control for account owner
function updateReferrerInfo(
address _referrer,
uint256 _referrerRate,
uint256 _authorityRate
) external {
if (_msgSender() == _referrer) {
revert InvalidReferrer(_referrer);
}
if (_referrer == address(0x0)) {
revert Errors.ZeroAddress();
}
if (_referrerRate < baseReferralRate) {
revert InvalidReferrerRate(_referrerRate);
}
uint256 referralExtraRate = referralExtraRateMap[_referrer];
uint256 totalRate = baseReferralRate + referralExtraRate;
if (totalRate > Constants.REFERRAL_RATE_DECIMAL_SCALER) {
revert InvalidTotalRate(totalRate);
}
if (_referrerRate + _authorityRate != totalRate) {
revert InvalidRate(_referrerRate, _authorityRate, totalRate);
}
ReferralInfo storage referralInfo = referralInfoMap[_referrer];
referralInfo.referrer = _referrer;
referralInfo.referrerRate = _referrerRate;
referralInfo.authorityRate = _authorityRate;
emit UpdateReferrerInfo(
msg.sender,
_referrer,
_referrerRate,
_authorityRate
);
}

Impact

This vulnerability can lead to unauthorized changes to referral data, where malicious actors could manipulate referral information to their advantage. For instance, an attacker could redirect referral rewards to their own account or to accounts under their control, depriving the rightful user of their rewards.

Tools Used

Manual Review

Recommendations

Add a check to verify that the caller is the account owner

Updates

Lead Judging Commences

0xnevi Lead Judge 11 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.