In TradingAccountBranch
, the function createTradingAccount
is used to create trading account of user. However, it is possible that user opens their first trading account without any referrer. This means that user wasn't referred to the protocol by anyone. But user can again open new trading account with referralCode
and the referrer
corresponding to the referralCode
will be added as referrer
to the user. Due to this, user can add someone as their referrer
even though they weren't technically referred by them.
A vulnerability exists in the referral code handling logic that allows a user to bypass the referral system by opening an account without a referrer initially and then adding a referrer later. This results in the system not recognizing that the user was not referred at the time of the first account opening, potentially leading to improper referral rewards and incentives.
Steps to reproduce:
Initial Account Opening without Referrer: A user can open an account without providing a referral code (referralCode.length == 0
).
Subsequent Account Opening with Referrer: The same user can later provide a referral code during another account opening attempt (referral.referralCode.length == 0
).
This scenario is problematic because it means the user did not have a referrer initially, but they can later claim to have one, which undermines the referral system's integrity.
Referrers may receive rewards for users who were not genuinely referred by them at the time of the first account opening.
Manual review
Ensure that a referral code must be provided at the time of the first account opening if the referral system is to be used. If no referral code is provided, then protocol should use some default referral code.
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.