In the natspec of the function initRefs() it clearly states "@notice deprecated" if this is truly the case it should be removed so that it cannot be misused in such a way to overwrite users referral hashes.
Proof of Concept
Alice sets up her referral code and gives it to her friend Bob who has a large position size. He can now save 10% on closing fees and Alice can get her earnings on position size.
Mallory sees that initRefs() was never called and that Bob has a pretty large position size.
Mallory calls initRefs() to overwrite Alice's referral code but with her address as the _codeOwner.
Bob goes to close out a trade and what was meant to be Alice's earnings on his position size is now Mallory's.
Tools Used
Manual Review
Recommended Mitigation Steps
Consider removing the function completely so it is not to be accidentally used or misused.
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/Referrals.sol#L58
Vulnerability details
Impact
In the natspec of the function
initRefs()
it clearly states"@notice deprecated"
if this is truly the case it should be removed so that it cannot be misused in such a way to overwrite users referral hashes.Proof of Concept
initRefs()
was never called and that Bob has a pretty large position size.initRefs()
to overwrite Alice's referral code but with her address as the_codeOwner
.Tools Used
Manual Review
Recommended Mitigation Steps
Consider removing the function completely so it is not to be accidentally used or misused.