Summary
referral_registry credit transfers XLM to an arbitrary referrer address provided by the caller. Since the referrer address is user-controlled (set in register_referral), a user can set their referrer to a malicious contract that reenters place_bet, claim, or cancel_refund on the prediction market.
Impact
- Reentrancy: a malicious referrer contract's fallback can reenter the prediction market before
BetEntry is written, observing stale state.
- Fund drain: the contract sends XLM to an address the caller controls — an attacker can set the referrer to their own contract and siphon fees.
- Unauthenticated external call: the XLM transfer is to a raw address with no validation that the referrer is a legitimate registered referrer.
Fix
- Validate that the referrer address is a registered referrer before paying.
- Use a reentrancy guard on
credit (and on any entry point that receives XLM from bets).
- Consider paying fees via a pull-based mechanism (accrue claims, let referrer withdraw) rather than push.
Summary
referral_registrycredittransfers XLM to an arbitrary referrer address provided by the caller. Since the referrer address is user-controlled (set inregister_referral), a user can set their referrer to a malicious contract that reentersplace_bet,claim, orcancel_refundon the prediction market.Impact
BetEntryis written, observing stale state.Fix
credit(and on any entry point that receives XLM from bets).