Users can set the same address as both the referrer and authority simultaneously, which will lead to incorrect rewards distribution because all rewards would go to a single address.
The protocol gives users the ability to set a referrer for taker orders, so rewards are split between the user and the referrer, allowing for reduced platform fees. However, the problem lies in how updateReferrer
incorrectly sets the referrer
address, as seen here (https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/SystemConfig.sol#L69-L70):
Because in createTaker
we retrieve referralInfo
like this (https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L199-L201):
This means that referralInfo.referrer
will always be msg.sender
itself, leading to referral rewards being distributed to a single user (https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L868-L886).
The referral system won’t function properly, and users can set themselves as their own referrers (using a different account), leading to significant protocol losses in fees. This is because anyone can make all orders cheaper for themselves by the baseReferralRate
value.
Foundry.
Fix it so that referral info is received for msg.sender
instead of _referrer
.
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.