Tadle

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

Referral system is broken due to wrong referralInfoMap update in the updateReferrerInfo function.

Summary

When updateReferrerInfo is called the function wrongly updates the given referrer's referralInfo instead of the msg.sender's referralInfo.

ReferralInfo storage referralInfo = referralInfoMap[_referrer];

Vulnerability Details

Example-

  • alice wants to change the referral rates and the authority rates

  • alice's referrer is bob,

  • alice calls updateReferrerInfo with bob, new rate, new rate,

  • but alice's referralInfoMap stays the same and the referralInfoMap of bob is changed instead.

Because of this mistake, the function is also open to anyone to call it to change someonelse's referral rates.
Example-

  • attacker calls updateReferrerInfo with referrer as Alice to change Alice's referrerRate s.

Impact

Breaks the whole purpose of the referral system,

  • a user can never set his own referral rate,

  • anyone can change the referral rates of someonelse.

Note: The intention or the design of the referral system is not clear, and I'm writing this report assuming the referralInfo is to be set by the user himself. But even the intention was to be set by someone else for the user, eitherway the system is still broken because anyone can change it or the user can change it himself. Also the mapping update is done for the given referrer and mapping itself has the given referrer as its own referrer, it makes no sense, both the rates will go to the given referrer.

Tools Used

manual

Recommendations

In updateReferrerInfo function replace the line :

- ReferralInfo storage referralInfo = referralInfoMap[_referrer];
+ ReferralInfo storage referralInfo = referralInfoMap[_msgSender()];
referralInfo.referrer = _referrer;
referralInfo.referrerRate = _referrerRate;
referralInfo.authorityRate = _authorityRate;
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.