Skip to content

[CRITICAL] credit transfers XLM to an arbitrary referrer address — reentrancy and fund-drain vector #165

Description

@grantfox-oss

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSThird CampaignCampaign: Third CampaigncriticalCritical severity - funds at riskreentrancyReentrancy / state-orderingsecuritySecurity vulnerability

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions