Back to skill

Security audit

Gate Exchange TradFi Query Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is a real Gate TradFi query-and-trading integration, but it needs Review because the README says it is read-only while the actual skill can place, amend, cancel, modify, and close trades with write permissions.

Review this carefully before installing. Treat it as a write-enabled Gate TradFi trading skill, not a read-only query helper. Only use it with credentials whose trading permissions you intentionally want to grant, verify every confirmation prompt before approving an order or position change, and prefer a separate read-only key if you only need account or market queries. The publisher should update the README and bundle or pin the shared runtime rules before this is considered low-risk.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (2)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:12
Finding
Mutable External Instructions Are Assigned Highest Priority<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:12-16` **Vulnerability Type**: `T01: Skill Instruction Hijacking` **Risk Level**: High ### Vulnerable Code Snippet ```markdown ⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding. Do NOT select or call any tool until all rules are read. These rules have the highest priority. → Read [gate-runtime-rules.md](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md) - **Only call MCP tools explicitly listed in this skill.** Tools not documented here must NOT be called, even if they exist in the MCP server. ``` ### Technical Analysis The skill delegates control of its runtime behavior to a remotely hosted Markdown document and declares that the remote rules have the “highest priority.” The URL references the mutable `master` branch rather than an immutable commit or content digest. Consequently, the effective instructions executed by the agent are not limited to the content reviewed in this artifact. A later repository modification, compromised maintainer account, or upstream repository compromise could change the remote instructions without changing the audited package. This is instruction hijacking rather than remote code execution: the external resource contains agent instructions, not an executable payload. Nevertheless, those instructions could attempt to alter tool-selection behavior, weaken transaction safeguards, request sensitive information, or redirect the agent toward actions unrelated to the user's intent. ### Attack Path 1. A user installs or invokes the audited skill. 2. The skill instructs the agent to retrieve `gate-runtime-rules.md` from the mutable `master` branch. 3. An attacker compromises the upstream repository, a maintainer account, or the referenced document. 4. The attacker inserts instructions that weaken confirmation requirements, solicit sensitive information, or redirect MCP tool usage. 5. The agent loads the m ...[truncated 1293 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Bundle the shared runtime rules inside the skill package so they are included in security review and version control. 2. If remote retrieval is unavoidable, pin the document to an immutable commit identifier rather than `master`. 3. Verify retrieved content against a trusted cryptographic digest or authenticated signed release. 4. Remove the assertion that externally retrieved content has the “highest priority.” 5. Explicitly state that skill and remote instructions cannot override system, developer, platform safety, or current user instructions. 6. Apply an allowlist to remote content: it should only provide domain guidance and must not redefine tools, permissions, confirmation requirements, credential handling, or data destinations. 7. Fail closed if the pinned rules cannot be retrieved or verified; do not fall back to unverified latest content. 8. Include the exact pinned rules version and digest in the package manifest and audit documentation. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
README.md:1
Finding
README Misrepresents a Write-Enabled Trading Skill as Read-Only<![CDATA[ ## Vulnerability Details **File Location**: `README.md:1-5`, `README.md:72-79`; contradicted by `SKILL.md:44-55`, `SKILL.md:122-130`, and `references/mcp.md:51-57` **Vulnerability Type**: `T05: Unauthorized Access and Privilege Escalation` **Risk Level**: High ### Vulnerable Code Snippets The public README describes the skill as read-only: ```markdown # Gate Exchange TradFi Query Skill ## Overview AI Agent skill for querying Gate TradFi (traditional finance) data in read-only mode. All MCP tools used are prefixed with `cex_tradfi`. It supports four query areas: order list and order history, current and historical positions, market data (category list, symbol list, ticker, symbol kline), and user assets plus MT5 account info. **No order placement, fund transfer, or balance transfer.** ``` The README repeats that claim in its security section: ```markdown ## Security and Scope - **Read-only**: This skill only queries data. It does **not** place or cancel orders, and does **not** perform fund transfers or balance transfers. - No credentials are stored or logged; balance, position, and MT5 account data are displayed only in the current response. - Confirmation is not required for query-only flows. ## Authentication This skill does **not** handle credentials directly. Authentication is managed by the Gate MCP platform layer — the MCP server holds the user's API key and injects it into API calls automatically. No environment variables or secrets are required by the skill itself. ``` However, `SKILL.md` declares write-enabled trading operations and requires write permission: ```markdown **Execution Operations (Write)** - cex_tradfi_close_position - cex_tradfi_create_tradfi_order - cex_tradfi_delete_order - cex_tradfi_update_order - cex_tradfi_update_position ### Authentication - API Key Required: Yes (see skill doc/runtime MCP deployment) - Permissions: Tradfi:Write ``` The authoritative MCP execution specification also exposes mutation tools: ...[truncated 2902 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Rewrite the README title and overview to identify the package as a query-and-trading skill rather than a query-only skill. 2. Explicitly list all supported write operations: - Place an order. - Amend an order. - Cancel an order. - Modify a position. - Fully or partially close a position. 3. Prominently disclose the `Tradfi:Write` permission requirement before installation and authentication instructions. 4. Update the architecture, capability table, examples, file structure, and security section to include all trading reference documents and mutation workflows. 5. Separate query and trading functionality into different skills or independently enabled modules. 6. Make the default installation read-only and require a deliberate opt-in before enabling mutation tools. 7. Recommend separate API credentials: - A read-only key for market, order, position, and asset queries. - A separately configured write-enabled key only when trading is explicitly required. 8. Enforce least privilege at the MCP server and API-key layer, not only through natural-language instructions. 9. Preserve the existing immediate confirmation, complete parameter display, and post-action verification controls. 10. Add automated consistency checks that fail releases when README capability claims conflict with tools or permissions declared in `SKILL.md` and `references/mcp.md`. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (13)

Ae1

High
Category
analysis-evasion
Content
- `SKILL.md` keeps routing and domain constraints.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Unrestricted Tool Access

Medium
Category
Excessive Agency
Content
## General Rules

⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding.
Do NOT select or call any tool until all rules are read. These rules have the highest priority.
→ Read [gate-runtime-rules.md](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md)
- **Only call MCP tools explicitly listed in this skill.** Tools not documented here must NOT be called, even if they
  exist in the MCP server.
Confidence
80% confidence
Finding
Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger list includes very broad verbs such as 'buy', 'sell', 'cancel', and 'close', which can cause this trading skill to activate for unrelated user requests. In a financial trading context, incorrect routing is risky because it can expose account data or steer the session toward trade execution flows when the user did not intend to interact with TradFi at all.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
### 2. Read sub-module and call tools

- Load the corresponding reference under `references/` and follow its Workflow.
- **Query**: Call query tools with extracted/prompted parameters; no confirmation needed.
- **Trading**: Build the parameter set per the reference and MCP; **output parameters for user confirmation**; only after user confirms, call the trading MCP tool; then **in the response, explain the parameters used and the outcome**.

### 3. Report
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Whitespace Padding

Medium
Category
Prompt Injection
Content
## Error Handling

| Situation                  | Action                                                                                                  |
| -------------------------- | ------------------------------------------------------------------------------------------------------- |
| Tool not found / 4xx/5xx   | Tell user the TradFi service or tool may be unavailable; suggest retry or check Gate MCP configuration. |
| Empty list                 | Report "No open orders" / "No positions" / "No symbols" etc., and do not assume error.                  |
Confidence
70% confidence
Finding
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
## Safety Rules

- **Query**: No confirmation required; display data after tool success.
- **Trading**: **Always** output parameters for user confirmation before calling place/amend/cancel/modify/close; **never** execute a write operation without explicit user confirmation. After execution, **always** explain in the response the parameters that were used and the outcome.
- **Sensitive data**: Do not log or store credentials or balances; display only in the current response.
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger examples include short, generic phrases such as 'Change take-profit to 1.08' that may match user utterances without clearly anchoring to a specific existing TradFi position. In a trading skill, overly broad activation can cause the agent to enter a position-modification workflow in response to ambiguous conversational text, increasing the chance of unintended trade-related actions or confusing prompts for confirmation.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The stop-loss examples are especially ambiguous because phrases like 'Modify position stop-loss 1.03' or 'Change stop-loss to 1.03' omit a clear asset or account context. In a financial trading environment, this can misroute ordinary discussion into a live order-modification flow, potentially leading to changes on the wrong position if the system attempts to resolve context from prior state.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The example triggers "Balance" and "How much do I have" are overly broad and can match many unrelated user intents, causing the TradFi skill to activate outside its intended scope. In a financial context, this misrouting can expose account balances or MT5 data when the user meant something non-financial, creating an avoidable privacy and data-minimization risk.

Unbounded Resource Access

Medium
Category
Excessive Agency
Content
1. Call `cex_tradfi_query_user_assets`.
2. Format as assets table (asset, available, locked, total).
3. If error or empty, reply "Unable to load assets" and do not retry indefinitely.
4. Do not expose API keys or secrets; only display balance data returned by the tool.

---
Confidence
75% confidence
Finding
Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
This markdown file states "All content in English," which is a natural-language locale constraint. Under the policy, forcing a specific language without offering the user a choice or documenting a justified regional need is a violation.

Vague Triggers

Low
Confidence
88% confidence
Finding
The example prompts include generic phrases such as "Order history," "My positions," and "Balance," which are broad enough to overlap with ordinary conversation or requests in other financial contexts. The README does not provide exclusion conditions or clear constraints describing when these phrases should or should not invoke this specific skill.

Vague Triggers

Low
Confidence
81% confidence
Finding
The trigger example "My TradFi balance" is too generic for a workflow that is supposed to handle a specific-asset query. This can cause the agent to select the one-asset scenario when the user actually wants a full balance overview, leading to incorrect tool usage or incomplete financial disclosure handling.

Static analysis

No suspicious patterns detected.