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:
- No per-transaction cap — a single call can drain 100% of accumulated fees.
- No provenance tracking — fees from market A can be withdrawn by a recipient who is only authorized for market B.
- 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_fees → place_bet → claim 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.
Summary
prediction_market/src/lib.rswithdraw_fees(lines ~1630-1660) allows the designated fee recipient to withdraw the entireAccumulatedFeesin a single call, with:Impact
withdraw_fees→place_bet→claimin a single transaction to drain additional value.Fix
request_withdraw_feesandexecute_withdraw_feesso governance can intervene.FeesWithdrawnevent with the source market IDs and amounts.