T09 · Insecure Skill Coding Practices
- Location
references/eth_grid.py:922- Finding
Unvalidated Remote Transaction Data Is Signed and Broadcast
- Content
View full analysis
tuple[str | None, dict | None]: """Execute swap via onchainos CLI + Agentic Wallet (TEE signing).""" if direction == "SELL": from_token, to_token = ETH_ADDR, USDC_ADDR else: from_token, to_token = USDC_ADDR, ETH_ADDR for attempt in range(2): quote_time = time.time() swap_data = onchainos_cmd( [ "swap", "swap", "--from", from_token, "--to", to_token, "--amount", str(amount), "--chain", chain, "--wallet", WALLET_ADDR, "--slippage", str(SLIPPAGE_PCT), ] ) if not swap_data or not swap_data.get("ok") or not swap_data.get("data"): detail = json.dumps(swap_data)[:200] if swap_data else "no response" log(f"Swap quote failed (attempt {attempt + 1}): {detail}") if attempt == 0: time.sleep(3) continue return None, { "reason": "swap_quote_failed", "detail": detail, "retriable": True, "hint": "transient_api_error", } tx = swap_data["data"][0]["tx"] log( f" OKX swap: to={tx['to'][:10]}... value={tx.get('value', '0')} " f"gas={tx.get('gas', 'N/A')} gasPrice={tx.get('gasPrice', 'N/A')}" ) sim_result = simulate_tx(tx) if direction == "BUY": router_addr = tx["to"] if not ensure_approval(router_addr, amount): ...[truncated 3704 chars]- Remediation
View remediation
