File: SystemConfig.sol
The updateReferrerInfo function is intended to store the referral information, ensuring that the referrer earns a commission when their referred peers complete a transaction. However, the function currently saves referralInfo.referrer as the referrer's own address. This allows a user to mistakenly or maliciously receive rewards on their own transactions, which contradicts the intended behavior described in the protocol's documentation. The correct behavior should be to store the address of the person who referred the user, ensuring that the referrer earns rewards only from their referred peers' transactions.
Mannually review
A user can exploit this flaw by setting themselves as the referrer in updateReferrerInfo. As a result, they will earn a referral bonus on their own transactions, rather than the bonus going to the actual person who referred them.
Here’s a sample test code to demonstrate this exploit:
This test can be placed in the PreMarkets.t.sol file to verify the issue.
Modify the updateReferrerInfo function to take peerAddress as an argument map it to the referrer in the referralInfoMap mapping. This will make sure that the referrer earns rewards on every transaction made by their referred peers.
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.