The referrer and authority bonus both go to the msg.sender of createTaker function.
In the _updateReferralBonus call from createTaker, the authority bonus is being updates in the msg.sender balance, and the referralBonus in the referralInfo's balance.
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L868-L886
But the referralInfo object is being obtained by calling the getReferralInfo function
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L199-L201
During the updation of the ReferralInfoMap in SystemConfig, the _referrer is used as the index.
https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/SystemConfig.sol#L69-L72
This means that referralInfoMap[msg.sender] will have msg.sender as the referrer. And thus the referrer bonus in createTaker also goes to the msg.sender rather than a different referrer.
Referral system is broken.
Manual Review
Rewrite the updateReferrerInfo function in Systemconfig.sol
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
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.