This vulnerability assumes that referralInfoMap correctly maps the referree to the referrer.
See my other submission titled: updateReferrerInfo() incorrectly sets address in referralInfoMap to referrer instead of referree)
Malicious protocol users can game the referral system by:
Creating two addresses: A1 and A2
A1 calls updateReferrerInfo() sending A2 as referrer parameter
A1 calls createTaker() on an offer.
Assuming referral rate is 30%, the malicious user can steal 30% of the protocol fee
Here's a POC (add to PreMarket.t.sol).
For the POC to run correctly, update this line in SystemConfig.sol to the following:
POC:
Protocol loses ~30% of protocol fees to malicious users that game the referral system.
Manual Review / Foundry
Right now, updateReferrerInfo() is set to external allowing anyone to game referral system. You may need to use a more centralized solution like affiliate tracking software to manage the referral system to prevent this. That said, I'm not an expert on on-chain referral systems, so there may be another way to do this in a decentralized fashion I'm unaware of.
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.