Back to skill

Security audit

Hyperliquid Trading Agent

Security checks for vulnerabilities and agentic risk

Overview

This trading skill appears purpose-built rather than malicious, but it needs Review because it can control automated trading agents while under-disclosing some sensitive data sharing and lacking hard confirmations for some consequential actions.

Review this carefully before installing. It is a real trading-control skill: it can create persistent agents, enable automated execution, open or close positions, withdraw funds, and upload Telegram bot credentials to ZoneIn. Use HITL mode first, avoid pasting bot tokens into logged shells when possible, verify wallet and agent IDs directly from fresh command output, and do not rely on the documentation claim that only the API key is transmitted.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/zonein.py:788
Finding

Misleading Disclosure of Sensitive Data Transmitted to the ZoneIn API

Content
View full analysis

Vulnerability Details

File Location: README.md:62, SKILL.md:279, scripts/zonein.py:164-183, scripts/zonein.py:788-797
Vulnerability Type: Incomplete privacy disclosure and transmission of reusable credentials
Risk Level: Medium

The documentation states:

text
Only your API key is sent externally (as X-API-Key header to https://mcp.zonein.xyz/api/v1)

However, the Telegram setup handlers transmit a reusable Telegram bot credential and, in the advanced setup flow, the user's chat identifier:

python
def cmd_telegram_setup_init(args):
    """Easy Telegram setup: provide bot_token only, then send /start to bot."""
    data = api_post("/telegram/setup-init", {"bot_token": args.bot_token})
    _output(data)


def cmd_telegram_setup(args):
    """Full Telegram setup with bot_token + chat_id."""
    data = api_post("/telegram/setup", {"bot_token": args.bot_token, "chat_id": args.chat_id})
    _output(data)

These values are serialized and sent to the ZoneIn service by the common request function:

python
def _do_request(path, params=None, method="GET", body=None):
    """Make authenticated request to Zonein API."""
    key = get_api_key()
    url = f"{API_BASE}{path}"
    if params:
        query = urllib.parse.urlencode({k: v for k, v in params.items() if v is not None})
        if query:
            url = f"{url}?{query}"

    data_bytes = None
    headers = {"X-API-Key": key, "Accept": CONTENT_JSON}
    if body is not None:
        data_bytes = json.dumps(body).encode("utf-8")
        headers["Content-Type"] = CONTENT_JSON

    req = urllib.request.Request(url, data=data_bytes, headers=headers, method=method)

    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            return json.loads(resp.read().decode("utf-8"))

Other handlers also transmit withdrawal and destination wallet addresses, trading strategies, risk configurat ...[truncated 2338 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace every “Only your API key is sent externally” statement with a complete disclosure of command-dependent data transmission.
  2. Explicitly identify Telegram bot tokens as reusable credentials and explain why ZoneIn needs them.
  3. Document server-side storage, encryption, access controls, retention, deletion, logging, and subprocessors for Telegram credentials.
  4. Obtain explicit confirmation immediately before uploading a bot token, including the destination and security implications.
  5. Avoid placing secrets on command lines where they can appear in shell history or process listings. Accept the token through protected standard input, a secret file with restrictive permissions, or an operating-system credential store.
  6. Ensure tokens are never returned in API responses, application logs, telemetry, exceptions, or support diagnostics.
  7. Encrypt stored bot tokens with a dedicated key-management service and restrict decryption to the minimum service identity.
  8. Provide token revocation and rotation instructions, and delete the stored token when Telegram integration is disabled.
  9. Clearly disclose the transmission of wallet addresses, order details, agent configuration, and financial metadata in the README and Skill manifest.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/zonein.py:501
Finding

Destructive Agent Deletion Lacks a Programmatic Confirmation Gate

Content
View full analysis

Vulnerability Details

File Location: scripts/zonein.py:501-505, scripts/zonein.py:1080-1084
Vulnerability Type: Missing authorization safeguard for a destructive operation
Risk Level: Medium

The deletion handler immediately issues an authenticated DELETE request:

python
def cmd_agent_delete(args):
    """Delete agent."""
    data = api_delete(f"/agents/{args.agent_id}")
    _output(data)

Its parser does not define a confirmation argument:

python
# --- Agent Delete ---
p = sub.add_parser("agent-delete", help="Delete agent")
p.add_argument("agent_id", type=str)
p.set_defaults(func=cmd_agent_delete)

By comparison, financially consequential handlers define --confirm and invoke _require_confirm. The project documentation expressly acknowledges that agent-delete has no such programmatic gate and relies on the AI agent to ask for verbal confirmation.

Technical Analysis

A destructive operation should enforce confirmation at the execution boundary rather than relying only on natural-language instructions. Model behavior can be affected by ambiguous user requests, stale context, orchestration mistakes, or prompt injection. Once the CLI is invoked with an agent ID, it has no way to distinguish explicit current-turn authorization from an accidental or manipulated call.

The API key supplies authority to delete the remote agent, while the CLI supplies no independent proof of intent. This violates defense-in-depth for agent-operated tools and is inconsistent with the stronger safeguard already implemented for financial commands.

Attack Path

  1. An attacker-controlled or ambiguous message is processed in a session where the Skill is enabled.
  2. The model or surrounding automation is induced to invoke agent-delete with a valid agent identifier.
  3. argparse accepts the command without requiring --confirm.
  4. cmd_agent_delete immediately calls api_delete.
  5. `_do ...[truncated 980 chars]
Remediation
View remediation

Remediation Suggestions

  1. Add a required --confirm parser option to agent-delete.
  2. Invoke _require_confirm(args, ...) before issuing the DELETE request.
  3. Require the user to confirm the exact agent ID and agent name in the current interaction.
  4. Consider a stronger challenge such as --confirm-agent-id agent_... so generic or stale confirmation cannot authorize deletion of a different agent.
  5. Implement server-side step-up confirmation or a short-lived deletion token obtained after presenting the target's details.
  6. Prefer soft deletion with a recovery window over immediate irreversible deletion.
  7. Return a preview of affected resources before deletion and record an audit event containing the authenticated user, target agent, timestamp, and confirmation method.
  8. Apply equivalent programmatic safeguards to other consequential state-changing operations instead of relying exclusively on model instructions.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (13)

Tainted flow: 'req' from os.environ.get (line 702, 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/zonein.py (reported line 182)May include surrounding context.

python
req = urllib.request.Request(url, data=data_bytes, headers=headers, method=method)

    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            return json.loads(resp.read().decode("utf-8"))
    except urllib.error.HTTPError as e:
        raw = e.read().decode("utf-8", errors="replace")

Tainted flow: 'req' from os.environ.get (line 702, 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/zonein.py (reported line 704)May include surrounding context.

python
}
    req = urllib.request.Request(url, data=body, headers=headers, method="POST")
    try:
        with urllib.request.urlopen(req, timeout=300) as resp:
            backtest_id = resp.headers.get("X-Backtest-Id", "")
            dashboard_url = resp.headers.get("X-Dashboard-Url", "")
            last_report = None

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 92)May include surrounding context.

md
For detailed command parameters, see [Commands Reference](references/COMMANDS.md).

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 183)May include surrounding context.

md
For detailed command parameters, see [Commands Reference](references/COMMANDS.md).

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 315)May include surrounding context.

md
For detailed command parameters, see [Commands Reference](references/COMMANDS.md).

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The security manifest asserts that all financial commands require a non-bypassable --confirm gate, but multiple state-changing commands do not enforce it, including agent-disable, agent-pause, agent-delete, telegram setup/disable, and some plan actions. In a trading-agent skill, this mismatch is dangerous because an orchestrating LLM or user may rely on the manifest and trigger destructive or account-affecting actions without an explicit approval checkpoint.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The agent-delete command performs irreversible remote deletion with no --confirm requirement and no execution-time disclosure. In this skill context, deleting a trading agent can disrupt trading operations, erase configuration/state access, and be triggered by mistaken or manipulated tool use, making the lack of a confirmation barrier materially risky.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
97% confidence
Finding

The skill exposes sensitive capabilities—environment variable access, local file reads, and outbound network use—yet does not declare an explicit permission or allowed-tools scope. In a financial trading skill, this broad implicit access increases the blast radius of prompt injection, logic mistakes, or future script changes that could exfiltrate API keys or misuse local configuration data.

Content

No source excerpt is available for this finding.

Behavior Manipulation

Medium
Category
Prompt Injection
Confidence
75% confidence
Finding

Subtle instructions detected that may alter agent decision-making or introduce hidden biases.

Content

Scanner excerpt · SKILL.md (reported line 198)May include surrounding context.

md
**`agent-update` supports FULL config changes** (same fields as `agent-create`):
`--prompt-config`, `--trigger-conditions`, `--trading-risk`, `--signal-weights`, `--strength-thresholds`, `--timeframe-weights`, `--assets`, `--categories`, `--leverage`, `--execution-mode`, `--withdrawal-addresses`, plus shorthand: `--trading-strategy`, `--custom-rules`, `--risk-management`.
NEVER tell user to delete and recreate an agent — use `agent-update` to change any config.

3. **Telegram:** Run `telegram-config`. If not connected, recommend setup — essential for HITL agents. See [Workflows](references/WORKFLOWS.md) for setup flow.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation instructs users to pass a Telegram bot token directly on the command line but does not warn that the token is a secret. Command-line arguments are commonly exposed through shell history, process listings, terminal logs, screenshots, and automation logs, so a leaked token could let an attacker control the bot, read/update webhook configuration, and abuse notification flows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This markdown file includes an agent configuration example with "execution_mode": "auto", indicating automated trading actions. The surrounding documentation does not include any warning about potential financial loss, autonomous order placement, or the risks of enabling automatic execution, which is a system- and data-impacting behavior for markdown under the warning rule.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · scripts/zonein.py (reported line 34)May include surrounding context.

python
perp-trader <addr> — Perp trader details
  agents           — List your trading agents
  agent-get <id>   — Get agent details
  agent-create     — Create a new trading agent
  agent-update <id>— Update agent config
  agent-deploy <id>— Deploy agent (validate + enable)
  agent-enable <id>— Enable agent

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The Telegram setup commands transmit a highly sensitive bot token to the remote API without any code-path warning or confirmation that the secret is being shared and stored server-side. While sending the token may be functionally necessary, the absence of explicit disclosure increases the chance of users unknowingly exposing a credential that can control a Telegram bot and its messaging flows.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.