Back to skill

Security audit

Ibkr Options Assistant

Security checks for vulnerabilities and agentic risk

Overview

This skill is a legitimate IBKR trading toolkit, but its order-cancel command can change live brokerage state without the same confirmation gates promised elsewhere.

Review before installing. Use a paper account or a read-only IBKR Gateway/user unless you explicitly want the agent to access live brokerage data. Do not rely on the advertised dual gates to protect order cancellation in this version; keep Gateway Read-Only API enabled or avoid exposing `trade.py cancel` until that behavior is fixed.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/trade.py:699
Finding

Live Brokerage Order Cancellation Bypasses Trading Authorization Gates

Content
View full analysis
dict[str, Any]: target_id = args.order_id open_trades = ib.openTrades() for tr in open_trades: if tr.order.orderId == target_id: ib.cancelOrder(tr.order) ib.sleep(1.0) return { "mode": "live", "action": "cancel", "order_id": target_id, "status_after_cancel": tr.orderStatus.status, } ``` The main authorization logic classifies cancellation as a read-only command: ```python env_enabled = _check_env_gate() # cancel and list-orders don't need gates (cancelling/reading is intrinsically safe) is_readonly_cmd = args.cmd in ("cancel", "list-orders") confirm_flag = getattr(args, "confirm_trade", False) ``` ### Technical Analysis `trade.py` normally protects live order placement with two independent controls: 1. The `IBKR_TRADING_ENABLED=1` environment variable. 2. The per-invocation `--confirm-trade` flag. However, the `cancel` command is treated as read-only and does not expose or enforce these controls. This classification is incorrect because `ib.cancelOrder()` changes live brokerage state. Cancellation can materially change financial exposure. For example, cancelling an exit, stop, hedge, or profit-taking order can leave a position unprotected. The implementation also connects through `ib_connect(..., readonly=False)`, so the broker connection has the authority required to execute the cancellation when the Gateway session permits it. The behavior conflicts with the documented security model in `README.md`, which groups order cancellation with brokerage capabilities that are off b ...[truncated 1612 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (88)

Tainted flow: 'req' from os.getenv (line 56, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/earnings_calendar.py (reported line 61)May include surrounding context.

python
"Accept": "application/json",
        })
        try:
            data = json.loads(urllib.request.urlopen(req, timeout=10).read())
        except Exception as e:
            log(f"  Nasdaq {d}: {e}")
            continue

Tainted flow: 'url' from os.getenv (line 85, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/earnings_calendar.py (reported line 87)May include surrounding context.

python
})
    url = f"https://finnhub.io/api/v1/calendar/earnings?{params}"
    try:
        with urllib.request.urlopen(url, timeout=10) as resp:
            data = json.loads(resp.read())
    except Exception as e:
        log(f"  Finnhub {symbol}: {e}")

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 11)May include surrounding context.

md
> [中文版 README](README.zh-CN.md)

<!-- screenshot: hero -->

---

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The README presents the toolkit as 'read-only' while also documenting a trade.py path that can submit or cancel orders when configuration gates are enabled. In a trading skill, that contradiction is dangerous because users and higher-level agents may rely on the read-only claim and invoke the skill in contexts where order-capable code should be excluded.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 226)May include surrounding context.

4. 配置环境变量

bash
cp .env.example .env
$EDITOR .env

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.zh-CN.md (reported line 217)May include surrounding context.

4. 配置环境变量

bash
cp .env.example .env
$EDITOR .env

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 227)May include surrounding context.

bash
cp .env.example .env
$EDITOR .env

需要确认的最小字段(默认通常就行):

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.zh-CN.md (reported line 218)May include surrounding context.

bash
cp .env.example .env
$EDITOR .env

需要确认的最小字段(默认通常就行):

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The documentation directly contradicts itself about whether the repository can trade, which creates a security-signaling failure. For a broker-connected skill, misleading safety claims materially increase the chance that operators, users, or orchestration systems grant trust or permissions they would not otherwise allow.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding highlights undeclared persistent local storage via ~/.ibkr_wheel_journal.json. Undocumented writes to the user's home directory can leak trading history, create privacy surprises, and persist state across sessions in ways the skill manifest does not signal.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file documents direct live trading and order cancellation in a skill whose manifest frames it primarily as an options and stock analysis/recommendation assistant. That scope expansion is dangerous because an orchestrator or user may invoke the skill expecting read-only analysis, while the referenced tooling can place real-money orders if environment and CLI gates are satisfied.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.