Back to skill

Security audit

Polymarket Kalshi Divergence

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed trading automaton, but live mode can make real recurring trades with weak market matching and fail-open safety checks.

Review this carefully before installing. Keep it in dry-run or paper-trading mode unless you have audited the market matching, set strict account and trade limits, pinned dependencies, and are comfortable with an automated job that can place repeated trades using your SIMMER_API_KEY.

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
kalshi_divergence.py:149
Finding

Insufficient Market Identity Validation Can Trigger Trades on Unrelated Markets

Content
View full analysis
dict | None: """Find best matching Polymarket market for a Kalshi market.""" kalshi_desc = extract_kalshi_description(kalshi_market).lower() # Try each keyword to search Polymarket for kw in keywords: try: markets = client.find_markets(query=kw) except Exception: markets = [] if not markets: continue # Score matches best_match = None best_score = 0 for pm in markets: q = (pm.question or "").lower() score = 0 # Check for overlapping terms kalshi_tokens = set(kalshi_desc.split()) pm_tokens = set(q.split()) overlap = len(kalshi_tokens & pm_tokens) score += overlap * 2 # Bonus for price-level matches (e.g., "$100,000", "above 5000") import re kalshi_nums = set(re.findall(r'\d+[,.]?\d*', kalshi_desc)) pm_nums = set(re.findall(r'\d+[,.]?\d*', q)) if kalshi_nums & pm_nums: score += 10 # Bonus for keyword in question if kw.lower() in q: score += 5 if score > best_score: best_score = score best_match = pm if best_match and best_score >= 5: return best_match return None ``` The selected market is subsequently used as the target of a live trade: ```python if live: try: result = client.trade( market_id=sig["market_id"], side=sig["side"], amount=TRADE_SIZE_USD, source=TRADE_SOURCE, ...[truncated 2663 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
kalshi_divergence.py:37
Finding

Trading Safety Checks Fail Open When Market Context Is Unavailable

Content
View full analysis
0.15: return False, "slippage too high" edge = ctx.get("edge_analysis", {}) if edge.get("recommendation") == "HOLD": return False, "edge below threshold" return True, "ok" except Exception: return True, "context unavailable" ``` The returned value directly controls whether execution proceeds: ```python ok, reason = check_context(client, sig["market_id"]) if not ok: log.warning("Skipping trade: %s", reason) continue if live: try: result = client.trade( market_id=sig["market_id"], side=sig["side"], amount=TRADE_SIZE_USD, source=TRADE_SOURCE, skill_slug=SKILL_SLUG, reasoning=reasoning, ) ``` ### Technical Analysis `check_context()` is intended to block trades when there is severe flip-flop activity, excessive slippage, or insufficient edge. However, every exception is converted into `(True, "context unavailable")`. This behavior treats the inability to evaluate safety as affirmative authorization. Exceptions may arise from: - Network failures or timeouts - SDK serv ...[truncated 1720 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
clawhub.json:4
Finding

Security-Sensitive Third-Party Dependencies Are Not Version-Pinned

Content
View full analysis
Remediation
View remediation
", "requests==" ] ``` 2. Generate and enforce cryptographic package hashes using a locked requirements file or equivalent reproducible dependency mechanism. 3. Verify package names, publishers, and official distribution sources before installation. 4. Use a trusted package index and disable untrusted fallback indexes to reduce dependency-confusion exposure. 5. Run dependency vulnerability and provenance checks in CI. 6. Review SDK release notes and relevant source changes before updating the pinned version. 7. Restrict the API key to the minimum required venue, account, trade size, and operation set where supported. 8. Isolate the process so dependencies cannot read unrelated files or environment variables. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes capabilities that require environment access and outbound network access, but it does not declare any explicit tool scope or permissions boundary. In an automation that polls APIs and can place trades when run live, missing scope declarations weakens least-privilege controls and can allow broader runtime capabilities than reviewers or operators expect.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

The skill is designed to auto-execute on a schedule every five minutes, which means trading decisions can be made without human review once deployed. Although it is dry-run by default, the documented --live mode turns the same autonomous loop into real trade execution, increasing the risk of unintended orders, strategy bugs, or abuse if configuration is changed or the environment is compromised.

Content

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

md
## Scheduling

Runs every 5 minutes via cron (`*/5 * * * *`). Managed automaton (auto-executes on schedule).
Dry-run by default. Pass `--live` to execute real trades.

## Requirements

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 · kalshi_divergence.py (reported line 61)May include surrounding context.

python
return True, "context unavailable"


KALSHI_API_BASE = "https://api.elections.kalshi.com/trade-api/v2"

BUY_THRESHOLD = float(os.environ.get('KALSHI_BUY_THRESHOLD', '0.08'))
SELL_THRESHOLD = float(os.environ.get('KALSHI_SELL_THRESHOLD', '0.10'))

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill can place real trades whenever the --live flag is supplied, with no interactive confirmation, secondary approval, or other safety gate immediately before order submission. In a trading skill that derives signals from heuristic market matching, this increases the chance of unintended financial loss from operator error, automation misuse, or bad signal generation.

Content

No source excerpt is available for this finding.