Back to skill

Security audit

Polymarket Multi Source Estimator

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed prediction-market trading bot, but it needs Review because it can repeatedly make financial trades from LLM estimates influenced by external internet data with limited safeguards.

Install only if you are comfortable running an automated trading bot. Keep it in dry-run or paper trading until you have reviewed the LLM endpoint, pinned dependencies, set strict trade-size and exposure limits, and added a fail-closed/manual-approval control for live trades. Use narrowly scoped, revocable API keys.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
multi_source_estimator.py:738
Finding

Untrusted Internet Content Can Influence Automated Financial Trades Through Prompt Injection

Content
View full analysis
str: """ Gather real-time context from all relevant sources in parallel. Returns a formatted string (max ~2000 chars) for injection into the LLM prompt. """ categories = detect_categories(question) if category and category not in categories: categories.insert(0, category) parts = [] # Always fetch news news = _match_news(question) if news: parts.append("RECENT NEWS:\n" + "\n".join(news)) # Dispatch category-specific sources in parallel with ThreadPoolExecutor(max_workers=4) as pool: futures = {} if any(c in categories for c in ["economics", "crypto"]): futures[pool.submit(_get_fred_context, question)] = "FRED" if "geopolitics" in categories: futures[pool.submit(_get_gdelt_context, question)] = "GDELT" if "sports" in categories: futures[pool.submit(_get_odds_context, question)] = "ODDS" if "politics" in categories: futures[pool.submit(_get_538_context, question)] = "538" futures[pool.submit(_get_congress_context, question)] = "CONGRESS" if "pharma" in categories: futures[pool.submit(_get_fda_context, question)] = "FDA" if "weather" in categories: futures[pool.submit(_get_meteo_context, question)] = "METEO" if any(kw in question.lower() for kw in ["earthquake", "quake", "seismic"]): futures[pool.submit(_get_usgs_context, question)] = "USGS" if any(kw in question.lower() for kw in ["earnings", "ipo", "revenue", "stock ...[truncated 5061 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
multi_source_estimator.py:1073
Finding

Live Trading Safety Checks Fail Open When Market Context Retrieval Fails

Content
View full analysis
0.15: log.warning("Skipping '%s...': slippage too high", question[:50]) continue except Exception as e: log.debug("Context check failed (non-blocking): %s", e) # Place trade try: amount = float(os.environ.get("TRADE_SIZE", "10.0")) result = client.trade( market_id=market_id, side=side.lower(), amount=amount, source=TRADE_SOURCE, skill_slug=SKILL_SLUG, reasoning=f"LLM estimate {est_prob:.0%} vs market {price:.0%} " f"(divergence {abs(divergence):.0%}). {reasoning}", ) ``` ### Technical Analysis The Skill attempts to check flip-flop warnings and estimated slippage before placing a trade. These are security- and risk-relevant preconditions because they are intended to prevent unstable or economically unfavorable execution. Any exception from `get_market_context()`, response parsing, or unexpected response types is caught and explicitly treated as non-blocking. Execution then continues to the trade block. Consequently, the absence of risk information is treated as permission to trade. This is a fail-open design. In a system capable of financial transactions, the safe default should be to reject or postpone a transaction when required risk controls cannot be evaluated. The code also uses permissive defaults such as `ctx.get( ...[truncated 1462 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
clawhub.json:4
Finding

Security-Sensitive Runtime Dependencies Are Not Version-Pinned

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (18)

Tainted flow: 'api_url' from os.environ.get (line 931, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
97% confidence
Finding

The LLM endpoint URL is taken directly from an environment variable and used in a POST request that includes the Authorization bearer token. If an attacker can influence LLM_API_URL, they can redirect prompts and secrets to an attacker-controlled server, causing credential exfiltration and leakage of market questions plus enriched external context. In a live trading bot, this also enables model-response manipulation that can steer trades.

Content

Scanner excerpt · multi_source_estimator.py (reported line 975)May include surrounding context.

python
try:
        _llm_calls_this_cycle += 1
        resp = requests.post(
            api_url,
            headers={"Authorization": f"Bearer {api_key}",
                     "Content-Type": "application/json",

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill description emphasizes estimation and data enrichment, but the documented behavior includes live trade execution, use of a trading client, and cross-platform market access without corresponding declared permissions. This mismatch is dangerous because reviewers or users may treat the skill as informational analysis while it can perform financially sensitive actions and broader network interactions.

Content

No source excerpt is available for this finding.

Ssd 1

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

Untrusted market questions and externally sourced text are concatenated directly into the prompt and framed as decision-relevant context. This creates a prompt-injection and data-poisoning risk: malicious or misleading source text can bias the model's probability estimate, and the result directly influences trading decisions in a live bot.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest and module docstring present this skill as a bot that trades when its estimate diverges from market price, including a '--live' mode. In the actual trade call, the reasoning string interpolates an undefined variable 'reasoning', which will raise a NameError before the trade executes, so the advertised live-trading behavior does not match the implemented code path.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill declares no explicit tool scope or permissions despite requiring environment-variable access, network access, and the ability to initiate trades through an external trading client. In an agent platform, missing permission declarations can cause operators or enforcement layers to underestimate the skill's effective capabilities, increasing the risk of unauthorized external calls or financial actions.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
88% confidence
Finding

The skill is configured to auto-execute on a schedule every five minutes and can place trades when run with live mode, meaning an LLM-driven decision process may repeatedly trigger external financial actions with limited human oversight. In the context of a trading bot, autonomous execution increases the blast radius of model errors, prompt/data poisoning from external sources, or configuration mistakes.

Content

Scanner excerpt · SKILL.md (reported line 122)May include surrounding context.

md
## Scheduling

Runs every 5 minutes via cron (`*/5 * * * *`). Managed automaton (auto-executes on schedule).
Capped at 50 LLM calls per run (`LLM_MAX_CALLS`) to control costs.

## Security

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 389)May include surrounding context.

python
results.append(cached)
            continue
        data = _safe_get(
            "https://api.stlouisfed.org/fred/series/observations",
            params={"series_id": sid, "api_key": api_key, "file_type": "json",
                    "sort_order": "desc", "limit": 5}
        )

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 431)May include surrounding context.

python
results.append(cached)
            continue
        data = _safe_get(
            "https://api.gdeltproject.org/api/v2/doc/doc",
            params={"query": query, "mode": "tonechart", "format": "json",
                    "timespan": "1d"}
        )

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 478)May include surrounding context.

python
cached = _get_cached(cache_key, _ODDS_TTL)
        if cached is None:
            cached = _safe_get(
                f"https://api.the-odds-api.com/v4/sports/{sport_key}/odds",
                params={"apiKey": api_key, "regions": "us,eu",
                        "markets": "h2h", "oddsFormat": "decimal"}
            )

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 557)May include surrounding context.

python
return []
    cached = _get_cached("congress_recent", _CONGRESS_TTL)
    if cached is None:
        data = _safe_get("https://api.congress.gov/v3/bill",
                         params={"api_key": api_key, "format": "json",
                                 "limit": 30, "sort": "updateDate+desc"})
        if data and "bills" in data:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 595)May include surrounding context.

python
if cached is None:
        today = datetime.utcnow().strftime("%Y%m%d")
        month_ago = (datetime.utcnow() - timedelta(days=60)).strftime("%Y%m%d")
        data = _safe_get("https://api.fda.gov/drug/drugsfda.json",
                         params={"search": f"submissions.submission_status_date:"
                                 f"[{month_ago}+TO+{today}]", "limit": 30})
        if data and "results" in data:

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 642)May include surrounding context.

python
cached = _get_cached(cache_key, _METEO_TTL)
    if cached is not None:
        return cached
    data = _safe_get("https://api.open-meteo.com/v1/forecast",
                     params={"latitude": lat, "longitude": lon,
                             "daily": "temperature_2m_max,temperature_2m_min",
                             "forecast_days": 16, "temperature_unit": "fahrenheit"})

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · multi_source_estimator.py (reported line 794)May include surrounding context.

python
_kalshi_cache = None
_kalshi_ts = 0.0

MANIFOLD_URL = "https://api.manifold.markets/v0"
KALSHI_URL = "https://trading-api.kalshi.com/trade-api/v2"

Ssd 4

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The prompt explicitly tells the model to 'weight real-time context heavily' and describes outside prices as a 'strong signal,' increasing trust in unverified external content. In this skill's context, that trust amplification is dangerous because multiple fetched sources and market text are untrusted and can be noisy, adversarial, or mismatched, yet they directly shape trading actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The code sends market questions and aggregated context to an external LLM service without a clear runtime disclosure or consent checkpoint. Even if the data is not highly sensitive, it may include proprietary strategy inputs, market selections, and third-party content that operators may not expect to be transmitted off-platform.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
82% confidence
Finding

This external transmission sends market questions, cross-platform pricing context, and aggregated real-time data to a third-party LLM provider. In a trading skill, that can expose strategy-relevant information and proprietary workflow data outside the local environment, with added risk if the provider retains prompts or the endpoint is misconfigured.

Content

Scanner excerpt · multi_source_estimator.py (reported line 975)May include surrounding context.

python
try:
        _llm_calls_this_cycle += 1
        resp = requests.post(
            api_url,
            headers={"Authorization": f"Bearer {api_key}",
                     "Content-Type": "application/json",

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The bot can place real trades immediately when run with --live, without any interactive confirmation or secondary safeguard at the point of execution. In a trading skill that also consumes untrusted external data and LLM output, this increases the chance of accidental or manipulated financial actions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The module docstring says the bot enriches with '10+ sources' and lists cross-platform prices from Manifold and Kalshi among those sources, while the source section is labeled 'Data sources (1-10)' and only enumerates ten context sources there; Manifold and Kalshi are implemented later in a separate cross-platform section. This documentation does not match the structure of the code and can mislead reviewers about what counts as enrichment context versus price comparison inputs.

Content

No source excerpt is available for this finding.