Tadle

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

Invalid `referralInfoMap` update

Summary

The updateReferrerInfo function in SystemConfig.sol allows arbitrary modification of referral information for any address.

Vulnerability Details

In the updateReferrerInfo function, the referralInfoMap is updated for the _referrer parameter rather than msg.sender. This allows any caller to set or modify referral information for any address, which may not be the intended behavior.

ReferralInfo storage referralInfo = referralInfoMap[_referrer]; //@audit invlalid update - Major
referralInfo.referrer = _referrer;
referralInfo.referrerRate = _referrerRate;
referralInfo.authorityRate = _authorityRate;

The behavior can be verified with the following script:

function testUpdateReferrerInfo() public{
address referrer = address(0x99);
vm.startPrank(user1); //owner
systemConfig.updateReferralExtraRateMap(
referrer,
100_000
);
vm.stopPrank();
vm.startPrank(user2);
systemConfig.updateReferrerInfo(
referrer,
350_000,
50_000
);
vm.stopPrank();
ReferralInfo memory r1 = systemConfig.getReferralInfo(referrer);
assertEq(r1.referrerRate, 350_000);
vm.startPrank(user3);
systemConfig.updateReferrerInfo(
referrer,
360_000,
40_000
);
vm.stopPrank();
ReferralInfo memory r2 = systemConfig.getReferralInfo(referrer);
assertEq(r2.referrerRate, 360_000);
}

Impact

Lead to unauthorized manipulation of referral data and corresponding calculations.

Tools Used

Manual

Recommendations

Considering update the referralInfoMapfor msg.sender instead of the referrer.

Updates

Lead Judging Commences

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