Back to skill

Security audit

Stock Expert

Security checks for vulnerabilities and agentic risk

Overview

This brokerage skill is coherent, but it needs Review because it can trade stocks and uses command templates with unquoted user-controlled parameters.

Install only if you trust the local kis_trade.py script and understand that the skill can reveal brokerage balances and place stock orders. Before use, add strict validation for stock codes, quantity, price, and side, use argument-array execution rather than shell-interpolated command strings, and require confirmation of the exact normalized order values.

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
SKILL.md:35
Finding

Shell Command Injection Through Unquoted Trading Parameters

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 35–42
Vulnerability Type: Command injection through unsafe shell command construction
Risk Level: High

Vulnerable Code

text
python "{{KIS_TRADE_SCRIPT_PATH}}" price {{symbol}}

### execute_order
주식을 매수하거나 매도합니다. **반드시 사전에 사용자의 확답을 받으세요.**
- `symbol` (string): 종목코드
- `qty` (number): 수량
- `price` (number): 주문 가격
- `side` (string): 'BUY' 또는 'SELL'

**Command:**
python "{{KIS_TRADE_SCRIPT_PATH}}" order {{symbol}} {{qty}} {{price}} {{side}}

Technical Analysis

The symbol, qty, price, and side parameters are interpolated directly into command templates without shell-safe quoting. Although the documentation describes expected types and values, it does not define or enforce validation constraints.

If the tool runner executes these templates through a shell, shell metacharacters contained in a parameter will be interpreted as command syntax rather than as a single argument. For example, a malicious symbol containing a command separator could terminate the intended argument and append another operating-system command.

Quoting KIS_TRADE_SCRIPT_PATH does not protect the other interpolated parameters. The requirement to obtain user confirmation before an order also does not prevent injection through price lookups or through malicious values included in an approved order.

Attack Path

  1. An attacker causes crafted text to be supplied as symbol, qty, price, or side, directly or through untrusted content processed by the Agent.
  2. The value includes shell syntax, such as a command separator followed by an operating-system command.
  3. The value is substituted directly into the documented command template.
  4. A shell-backed tool runner parses the injected syntax.
  5. The intended Python invocation runs, fails, or is bypassed, while the appended attacker-controlled command executes with the privileges of the Agent process.

A representative malicious symbol would ha ...[truncated 1054 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not execute interpolated command strings through a shell. Invoke Python with an argument-array API equivalent to:
text
["python", KIS_TRADE_SCRIPT_PATH, "order", symbol, qty, price, side]
  1. Apply strict allowlist validation before invocation:

    • Require symbol to match ^[0-9]{6}$.
    • Require qty to be a positive integer within an explicitly configured maximum.
    • Require price to be a positive numeric value within appropriate market and account limits.
    • Require side to equal exactly BUY or SELL.
    • Reject unexpected whitespace, control characters, shell metacharacters, and extra arguments.
  2. Resolve and validate KIS_TRADE_SCRIPT_PATH against an administrator-controlled allowlisted path. Verify that it points to a regular file with trusted ownership and is not writable by untrusted users.

  3. Preserve the existing explicit confirmation requirement, but display and confirm the normalized symbol, side, quantity, price, and estimated order value. Bind approval to those exact values and invalidate it if any value changes.

  4. Run the trading process with least privilege, restrict its filesystem and network access, and expose brokerage credentials only to the process that requires them.

  5. Add negative tests using command separators, substitutions, redirects, newlines, and argument-injection payloads to verify that malformed values are rejected and never interpreted by a shell.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The entire skill description and operational instructions are written only in Korean, and no opt-in or alternative language behavior is offered. Under the locale policy, language constraints should either provide user choice or clearly document a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill exposes highly sensitive financial account information through portfolio and balance queries, but it does not explicitly warn users that invoking these tools will reveal account holdings, cash balance, and performance data. In an agent setting, missing this disclosure increases the risk of unintended exposure of private financial information, especially in shared sessions or when users do not realize the sensitivity of the requested action.

Content

No source excerpt is available for this finding.