Skip to content

[CRITICAL] withdraw_fees lets fee recipient drain entire accumulator — no cap, no provenance #172

Description

@grantfox-oss

Summary

prediction_market/src/lib.rs withdraw_fees (lines ~1630-1660) allows the designated fee recipient to withdraw the entire AccumulatedFees in a single call, with:

  1. No per-transaction cap — a single call can drain 100% of accumulated fees.
  2. No provenance tracking — fees from market A can be withdrawn by a recipient who is only authorized for market B.
  3. No per-market segregation — the accumulator is a single global pool mixing fees from all markets.

Impact

  • A compromised or malicious fee recipient can steal the entire platform fee reserve in one transaction.
  • If the fee recipient is a contract, it can chain withdraw_feesplace_betclaim in a single transaction to drain additional value.
  • Cross-market contamination: fees earned by market A are indistinguishable from fees earned by market B, so a recipient authorized for only one market can steal from the other.

Fix

  • Cap single withdrawals to a percentage of the accumulator (e.g., 10% per call) with a timelock.
  • Track fee provenance per market and only allow withdrawal of fees earned by markets the recipient is authorized for.
  • Require a timelock between request_withdraw_fees and execute_withdraw_fees so governance can intervene.
  • Emit a FeesWithdrawn event with the source market IDs and amounts.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSThird CampaignCampaign: Third CampaignaccountingAccounting / fee logiccriticalCritical severity - funds at risksecuritySecurity vulnerability

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions