T09 · Insecure Skill Coding Practices
- Location
copytrading_trader.py:714- Finding
Paper-Trading Reactor Signals Can Trigger Real-Money Trades
- Content
View full analysis
Vulnerability Details
File Location:
copytrading_trader.py:714-735
Vulnerability Type: Paper-to-live trading authorization escalation
Risk Level: HighVulnerable Code
python # Venue auto-routing: when the signal targets Simmer (LMSR) but the size # exceeds the venue's per-trade hard cap, try Polymarket instead so the user # follows the whale's actual size rather than getting silently capped. # Respects COPYTRADING_FORCE_SIMMER_VENUE=true and user's explicit polymarket venue. effective_venue = venue effective_amount = amount _rerouted_to_polymarket = False # Auto-route requires an EXPLICIT sim venue — a defaulted (omitted) venue # must never escalate to real-USDC polymarket; it stays on sim and gets # capped by the venue instead (fail-safe). if (not FORCE_SIMMER_VENUE and raw_venue == "sim" and amount > SIMMER_VENUE_TRADE_CAP_USD): _rerouted_to_polymarket = True effective_venue = "polymarket" print( f"[reactor] {tx_short}... amount {amount:.2f} $SIM > {SIMMER_VENUE_TRADE_CAP_USD:.0f} $SIM cap " f"→ routing to polymarket" )The resulting venue is subsequently passed to the trade execution path:
python result = _attempt_trade(effective_venue, effective_amount, trade_price)Technical Analysis
Reactor responses are received from the remote Simmer API and supply security-sensitive trade fields, including
venue,amount,market_id,side, andaction. When such a signal explicitly specifies the simulatedsimvenue and its amount exceeds the $500 simulated-venue cap, the code automatically changes the execution venue topolymarket.This crosses a material authorization boundary: a signal denominated for a paper-trading venue is transformed into a real-money Polymarket order. The reroute does not require an explicit per-order confirmation, a dedicated positive opt-in to paper-to-live conversion, or the normal
--liveauthorization gate. Reactor mode is always live, ...[truncated 1847 chars]- Remediation
View remediation
Remediation Suggestions
- Remove automatic
sim-to-polymarketrerouting. Oversized simulated trades should be capped at the simulated venue’s limit or rejected. - Preserve the venue specified by each signal as a strict security boundary rather than treating it as a routing preference.
- If cross-venue execution is required, place it behind an explicit opt-in such as
--allow-real-venue-reroute; default this option to disabled. - Require both
--liveand an explicit real-money venue selection before Reactor mode can submit Polymarket orders. - Enforce a local maximum real-money amount independent of remotely supplied signal values and server-side configuration.
- Before any paper-to-live conversion, display the destination venue, amount, market, side, and estimated cost and require an interactive confirmation. For unattended operation, require a separately stored policy that explicitly authorizes such conversion.
- Add regression tests proving that an explicit
simsignal remains onsim, including when its amount exceeds the simulated-venue cap. - Consider cryptographically binding Reactor configurations to the intended venue and rejecting signals whose venue or amount conflicts with that locally approved configuration.
- Remove automatic
