Tadle

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

Misleading Referral Information Update in SystemConfig::updateReferrerInfo Function

Vulnerability Details

The updateReferrerInfo function contains logic that could lead to confusion and potential misuse of the referral system. It updates referral information for a given referrer address, but includes a misleading self-referential assignment.

ReferralInfo storage referralInfo = referralInfoMap[_referrer];
referralInfo.referrer = _referrer;

[Link to code](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/SystemConfig.sol#L69-L70)


Issues:

  1. The function name suggests updating referrer info for the caller, but it actually updates info for the _referrer parameter.

  2. Setting referralInfo.referrer = _referrer creates a self-referential entry, which is likely not the intended behavior.

  3. The function allows any address to update referral information for any other address (except themselves), which could be a security risk.

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

    [Link to code](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/SystemConfig.sol#L46-L48)

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.