T01 · Skill Instruction Hijacking
- Location
SKILL.md:121- Finding
AI Agent Instructions Recommend Bypassing Live-Trade Confirmation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real LongPort brokerage CLI, but it tells AI agents to bypass trade confirmations while using stored brokerage credentials.
Install only if you intend to let an AI-accessible CLI read your Longbridge account data. Keep the default read-only mode unless you are deliberately trading, avoid using --yes/-y for live orders, prefer a paper or read-only profile for agent workflows, and review the profile/env-file handling and dependency pinning before using it with a real brokerage account.
SKILL.md:121AI Agent Instructions Recommend Bypassing Live-Trade Confirmation
longbridge_cli/config.py:21Unvalidated Profile Name Allows Environment-File Path Traversal
pyproject.toml:1Security-Critical Brokerage Dependencies Are Not Reproducibly Pinned
longbridge_cli/commands/order.py:59Live Order Parameters Lack Local Range and Finiteness Validation
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
|----------|----------|-------------|
| `LONGBRIDGE_APP_KEY` | ✅ | App Key |
| `LONGBRIDGE_APP_SECRET` | ✅ | App Secret |
| `LONGBRIDGE_ACCESS_TOKEN` | ✅ | Access Token |
| `LONGBRIDGE_TRADE_ENABLED` | Optional | Set to `true` to enable trading (default: read-only) |
---
There is a clear mismatch between the description and the supplied code chunk. The description claims a full-featured LongPort CLI covering quotes, holdings, orders, and market analytics. However, the actual code is only an __init__.py file with a package docstring and no executable logic or exposed functionality. Based on the provided code alone, none of the declared capabilities are present.
代码文件是 commands/quote.py,从实现上看只注册了 quote、depth、trades、candlesticks、info 五个命令,全部依赖 QuoteContext 获取行情或标的静态信息。没有看到账户上下文、订单上下文、交易接口、持仓查询或任何资金/期权相关调用。因此,若将“该 skill”的声明理解为这段代码所代表的能力,则声明明显比实际代码宽得多,尤其把账户和订单管理说成已提供,构成描述与行为不一致。虽然声明中的行情查询部分与代码一致,但整体用途被显著夸大,因此应判定为 mismatch。
The trigger language is extremely broad and includes ordinary requests like checking a stock price or 'help me place an order,' causing the skill to auto-activate in many ambiguous situations. In this context the skill has access to brokerage credentials and trading commands, so overbroad invocation materially raises the risk of unintended access to account data or accidental execution of sensitive financial actions.
The documentation explicitly recommends using --yes/-y to bypass trade confirmations for AI agent automation, without strong safeguards or warnings. In a brokerage skill, this removes a key human-in-the-loop control and can enable erroneous or unauthorized buy, sell, or cancel actions with immediate financial consequences.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# ---------------------------------------------------------------------------
# .env 加载(CLI 包自包含,不依赖 trader 包)
# ---------------------------------------------------------------------------
def _load_dotenv_for_profile(profile: str | None = None) -> None:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
profile 非空 + 文件不存在 → 抛 FileNotFoundError。
已存在的环境变量不会被覆盖。
"""
filename = f".{profile}.env" if profile else ".env"
env_path: Path | None = None
for base in [Path.cwd(), Path.home()]:
candidate = base / filename
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
Create a .env file in the current directory or home directory (~/.env):
LONGBRIDGE_APP_KEY=your_app_key
The README explicitly documents --yes/-y to bypass confirmation for buy/sell operations, enabling non-interactive trade execution. In an AI-agent context, this materially increases the chance of autonomous or accidental order placement if the agent is permitted to invoke the CLI with trading enabled.
longbridge cancel 701234567890
longbridge buy AAPL.US --qty 100 --price 180.0 --yes longbridge sell 700.HK --qty 500 --price 320.0 -y
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
Copy SKILL.md to your OpenClaw skills directory to register it as a Clawdbot Skill:
mkdir -p ~/.openclaw/skills/longbridge-cli
cp SKILL.md ~/.openclaw/skills/longbridge-cli/SKILL.md
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
Copy SKILL.md to your OpenClaw skills directory to register it as a Clawdbot Skill:
mkdir -p ~/.openclaw/skills/longbridge-cli
cp SKILL.md ~/.openclaw/skills/longbridge-cli/SKILL.md
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
mkdir -p ~/.openclaw/skills/longbridge-cli
cp SKILL.md ~/.openclaw/skills/longbridge-cli/SKILL.md
Once installed, Claude can invoke longbridge-cli commands automatically when you ask about account balances, positions, quotes, or orders.
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
mkdir -p ~/.openclaw/skills/longbridge-cli
cp SKILL.md ~/.openclaw/skills/longbridge-cli/SKILL.md
Once installed, Claude can invoke longbridge-cli commands automatically when you ask about account balances, positions, quotes, or orders.
The combination of persistent multi-account profile files (.<name>.env) and documented non-interactive trade execution increases the blast radius of mistakes: an agent or script can repeatedly access stored live credentials and place trades without human confirmation. In a trading skill, this persistence is more dangerous than in a read-only data tool because it supports durable access to high-impact actions.
### Notes
- **Read-only mode**: `buy`/`sell`/`cancel` require `LONGBRIDGE_TRADE_ENABLED=true`
- **Trade confirmation**: Even with trade permission enabled, all write commands prompt for confirmation before executing. Use `--yes` / `-y` to skip the prompt for scripted or programmatic use
- **Multi-account profiles**: Use `longbridge --profile <name>` to load `.<name>.env` credentials (e.g., `--profile paper` loads `.paper.env`). Useful for switching between paper trading and live accounts
- **HK symbol format**: Must use 4-digit format, e.g. `0700.HK` (leading zero required)
- **Error handling**: SDK exceptions are caught and displayed as friendly messages
The skill declares access to sensitive environment variables containing API credentials but does not define any explicit tool scope or permission boundary. In an agent setting, this increases the chance that secrets are exposed to components or workflows beyond what is necessary, especially since the skill also supports account and trading operations.
The module's docstrings, help text, table headers, and titles are all presented in Chinese, with no indication that users can select another language or that the tool is intentionally limited to a Chinese-speaking locale. This can violate language/locale policy when a skill forces a specific language without user opt-in or documented justification.
The command retrieves account balance and net asset information via TradeContext(...).account_balance() and then prints it, but the code provides no explicit warning, confirmation, or disclosure that sensitive financial account data will be accessed and displayed. For code files, safety-relevant access to sensitive data should have some visible disclosure unless clearly covered elsewhere.
The positions command fetches portfolio holdings using stock_positions() and outputs symbols, quantities, and cost basis data, which are sensitive financial details. There is no confirmation prompt, disclosure message, or warning in the command text indicating that personal portfolio data will be retrieved and shown.
The funds command retrieves fund holding details, including holdings, valuation, and cost data, then prints them without any explicit disclosure to the user. This is sensitive account information, and the code does not include a warning, confirmation, or explanatory notice.
No suspicious patterns detected.