Back to skill

Security audit

IBKR CLI

Security checks for vulnerabilities and agentic risk

Overview

This IBKR skill is coherent and not deceptive, but it can place or cancel real brokerage orders without a confirmation or dry-run safeguard.

Review this skill before installing if you may connect it to a live IBKR account. Prefer paper trading first, pin `ib_insync` in a virtual environment, use explicit account/client/port settings, and avoid letting an agent run `place-order` or `cancel-order` without your direct approval.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:28
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:28-31
Vulnerability Type: Unpinned dependency installation from a public package registry
Risk Level: Medium

Vulnerable Code:

markdown
- `ib_insync` installed:

```bash
pip install ib_insync
text

### Technical Analysis

The documented installation command resolves and installs the latest version of `ib_insync` available from pip's configured package index. It does not constrain the dependency to a reviewed version, validate an integrity hash, use a lock file, or identify a trusted package source.

Package installation and subsequent imports can execute third-party code with the privileges of the user running pip or the trading CLI. Consequently, the effective code installed by this procedure can change after the Skill has been audited. Exploitation would require compromise of the package distribution channel, the package publisher, a configured package index, or the dependency resolution environment.

### Attack Path

1. An attacker compromises a future `ib_insync` release, its publisher account, a package index used by the victim, or the victim's dependency-resolution path.
2. The victim follows the documented `pip install ib_insync` command.
3. pip resolves the attacker-controlled or compromised release because no reviewed version or hash is required.
4. Malicious package code executes during installation or when `ib_insync` is imported by `scripts/ibkr_cli.py`.
5. The malicious code operates with the installing or CLI user's privileges and may access resources available in that execution environment.

### Impact Assessment

Successful exploitation could provide arbitrary Python code execution with the privileges of the user installing or running the package. The accessible scope could include local files, environment variables, network resources, and the local IBKR TWS/Gateway session available to that user. In a trading-enabled environment, c
...[truncated 192 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin ib_insync to a specifically reviewed version rather than installing the latest release implicitly.
  2. Place the dependency in a version-controlled requirements file with cryptographic hashes, for example:
    text
    ib_insync==<reviewed-version> --hash=sha256:<verified-hash>
    
  3. Install it using hash enforcement:
    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  4. Record and verify the expected package index, package publisher, and artifact provenance.
  5. Review transitive dependencies and pin them through a generated lock file.
  6. Perform installation in an isolated virtual environment using a non-privileged account.
  7. Test dependency upgrades against an IBKR paper-trading environment before approving them for production use.
  8. Configure TWS or IB Gateway with the minimum necessary API permissions and use read-only mode for commands that do not require trading access.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documents operational code that uses environment variables for connection and account context, but it does not declare an explicit tool scope such as permissions or allowed-tools. In an agent setting, this can lead to overbroad runtime access assumptions and makes it harder to constrain how the skill interacts with local environment state, which is especially risky for a trading integration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly documents live trading actions such as placing and canceling orders, but it does not include a clear warning that these commands can affect real brokerage accounts and positions. In the context of an IBKR trading skill, omission of such safeguards increases the chance of accidental destructive actions, unauthorized trades, or irreversible financial loss if an agent or user invokes examples verbatim.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The CLI can place live market and limit orders immediately based solely on command-line arguments, with no secondary confirmation, dry-run default, or explicit acknowledgement that the action is irreversible and may affect real funds. In a trading skill, this materially increases the chance of accidental or scripted misuse, especially because connection/account settings can default from environment variables and the command is designed for direct execution against TWS/Gateway.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The cancel-order command attempts to cancel a live order immediately when given an order ID, without any confirmation or warning. Although cancellation is generally less dangerous than placement, it can still disrupt intended trading strategies, remove protective orders, or create financial exposure if triggered accidentally or by automation using the wrong order ID.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This wrapper directly invokes order placement based on command-line arguments and provides no explicit confirmation, dry-run mode, or safety interlock before submitting a potentially irreversible trade. In a trading skill, that omission is materially risky because accidental invocation, malformed automation inputs, or misuse by an upstream agent can trigger real market orders and financial loss.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.