Summary
prediction_market/src/lib.rs place_bet calls referral_registry.credit(...) with the referrer address, but never validates that the referrer is actually registered in the referral registry. Any user can pass an arbitrary address as their "referrer" and the system will pay referral fees to it.
Impact
- Free fee diversion: a user can set any address as referrer — including their own hot wallet or a contract they control — and receive referral fees with no validation.
- No registration proof: there is no check that the referrer's address has a valid
ReferrerInfo record or has opted into the referral program.
- Sybil amplification: an attacker can self-refer all bets, claiming the 50 bps referral fee on every trade.
Fix
- In
place_bet, before calling credit, verify the referrer address exists in ReferrerInfo storage.
- If the referrer is not registered, treat the bet as referrer-less and route the 50 bps to
AccumulatedFees instead.
- Add a
is_registered_referrer(address) view function to the referral registry for cross-contract validation.
Summary
prediction_market/src/lib.rsplace_betcallsreferral_registry.credit(...)with the referrer address, but never validates that the referrer is actually registered in the referral registry. Any user can pass an arbitrary address as their "referrer" and the system will pay referral fees to it.Impact
ReferrerInforecord or has opted into the referral program.Fix
place_bet, before callingcredit, verify the referrer address exists inReferrerInfostorage.AccumulatedFeesinstead.is_registered_referrer(address)view function to the referral registry for cross-contract validation.