Skip to content

[CRITICAL] register_referral doesn't validate that the referrer is registered — unregistered referrers get paid #176

Description

@grantfox-oss

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.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSThird CampaignCampaign: Third CampaigncriticalCritical severity - funds at riskprediction-marketPrediction market contractreferralReferral registry contract

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions