Back to skill

Security audit

Weex

Security checks for vulnerabilities and agentic risk

Overview

This is a real WEEX trading helper, but it needs Review because it exposes broad live financial actions, partner-data endpoints, and unvalidated credential-bearing API destinations.

Install only if you are comfortable granting an agent live WEEX trading authority. Use least-privilege API keys, avoid withdrawal or affiliate permissions unless absolutely needed, avoid storing production keys in broad shell profiles, keep base URLs pinned to official WEEX HTTPS hosts, and require your own explicit dry-run plus confirmation before any trade, cancellation, margin/leverage change, position close, or transfer-like action.

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

Error
Location
scripts/weex_spot_api.py:160
Finding
Spot API credentials can be transmitted to an arbitrary host through an unrestricted base URL<![CDATA[ ## Vulnerability Details **File Location**: `scripts/weex_spot_api.py:160-194, 365` **Vulnerability Type**: Arbitrary credential-bearing network destination **Risk Level**: High ### Vulnerable Code ```python if endpoint.requires_auth: self._require_auth() ts = str(int(time.time() * 1000)) sign = self._sign(ts, method, endpoint.path, query_string, body_str) headers.update( { "ACCESS-KEY": self.api_key, "ACCESS-PASSPHRASE": self.api_passphrase, "ACCESS-TIMESTAMP": ts, "ACCESS-SIGN": sign, } ) url = f"{self.base_url}{endpoint.path}" if query_string: url = f"{url}?{query_string}" data = body_str.encode("utf-8") if body_str and method != "GET" else None return { "method": method, "url": url, "headers": headers, "data": data, "query": q, "body": b, } def send(self, prepared: Dict[str, Any]) -> Dict[str, Any]: req = request.Request( url=prepared["url"], method=prepared["method"], data=prepared["data"], headers=prepared["headers"], ) try: with request.urlopen(req, timeout=self.timeout) as resp: ``` The destination is supplied without validation: ```python parser.add_argument("--base-url", default=os.getenv("WEEX_SPOT_API_BASE", DEFAULT_BASE_URL)) ``` ### Technical Analysis The Spot client accepts its base URL from either the `--base-url` command-line option or the `WEEX_SPOT_API_BASE` environment variable. It does not validate the URL scheme, hostname, port, user-information component, or path. For authenticated endpoints, the client then attaches the following sensitive headers to a request targeting that unrestricted URL: - `ACCESS-KEY` - `ACCESS-PASSPHRASE` - `ACCESS-TIMESTAMP` - `ACCESS-SIGN` The HMAC-SHA256 signature is Base64-encoded as required by the WEEX authentication protocol. That encoding is legitimate and is not, by itself, a covert exfiltration mechanism. The security f ...[truncated 2551 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Parse the configured base URL before creating any authenticated request. 2. Require the `https` scheme. 3. Allowlist the exact official Spot API hostname: - `api-spot.weex.com` 4. Reject URLs containing: - User-information components. - Fragments. - Unexpected ports. - Unexpected path prefixes. - Non-HTTPS schemes. 5. Perform validation immediately before sending, not only while parsing command-line arguments. 6. Prevent authentication headers from being forwarded to a different origin during redirects. Prefer disabling redirects for authenticated API requests or validating every redirect target. 7. If custom endpoints are required for local testing: - Require a separate, explicitly unsafe testing option. - Display a prominent warning. - Refuse to load production credential environment variables in custom-host mode. - Require separately named test credentials. 8. Add automated tests confirming that authenticated requests to unknown hosts, plain HTTP destinations, and unexpected ports are rejected. 9. Document that production credentials must only be sent to the official WEEX API origin. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/weex_contract_api.py:159
Finding
Contract API credentials can be transmitted to an arbitrary host through an unrestricted base URL<![CDATA[ ## Vulnerability Details **File Location**: `scripts/weex_contract_api.py:159-193, 442` **Vulnerability Type**: Arbitrary credential-bearing network destination **Risk Level**: High ### Vulnerable Code ```python if endpoint.auth: self._require_auth() timestamp_ms = str(int(time.time() * 1000)) sign = self._sign(timestamp_ms, method, endpoint.path, query_string, body_str) headers.update( { "ACCESS-KEY": self.api_key, "ACCESS-PASSPHRASE": self.api_passphrase, "ACCESS-TIMESTAMP": timestamp_ms, "ACCESS-SIGN": sign, } ) url = f"{self.base_url}{endpoint.path}" if query_string: url = f"{url}?{query_string}" data = body_str.encode("utf-8") if body_str and method != "GET" else None return { "method": method, "url": url, "headers": headers, "data": data, "query": q, "body": b, } def send(self, prepared: Dict[str, Any]) -> Dict[str, Any]: req = request.Request( url=prepared["url"], method=prepared["method"], data=prepared["data"], headers=prepared["headers"], ) try: with request.urlopen(req, timeout=self.timeout) as resp: ``` The destination is supplied without validation: ```python parser.add_argument("--base-url", default=os.getenv("WEEX_API_BASE", DEFAULT_BASE_URL)) ``` ### Technical Analysis The Contract client accepts an arbitrary base URL from `--base-url` or `WEEX_API_BASE`. No restriction ensures that authenticated requests are sent only to the official `api-contract.weex.com` origin. When an endpoint is marked as authenticated, the client creates an HMAC-SHA256 signature and attaches the API key, passphrase, timestamp, and signature. It then combines the unvalidated base URL with the endpoint path and sends the resulting request through `urlopen()`. Base64 encoding of the HMAC digest is required by the documented WEEX signing protocol and is not evidence of hidden payload encodi ...[truncated 2193 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require authenticated Contract requests to use `https://api-contract.weex.com`. 2. Parse and validate the URL using a structured URL parser rather than string concatenation. 3. Reject: - Non-HTTPS schemes. - Unknown hostnames. - User-information components. - Unexpected ports. - Fragments. - Unexpected base paths. 4. Revalidate the final origin immediately before sending an authenticated request. 5. Disable redirects for authenticated requests or validate every redirect destination and remove authentication headers whenever the origin changes. 6. Separate production and test modes: - Custom hosts should require an explicit unsafe testing flag. - Production environment credentials should not be accepted in custom-host mode. - Test mode should use separately named, non-production credentials. 7. Add regression tests covering malicious hosts, plain HTTP, hostname suffix tricks, user-information URLs, unexpected ports, and redirect attempts. 8. Update the setup documentation so that users do not treat `WEEX_API_BASE` as an unrestricted endpoint setting. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (25)

Description-Behavior Mismatch

Critical
Confidence
100% confidence
Finding
The file exposes an authenticated internal withdrawal endpoint that can transfer funds to another user, yet this capability is not disclosed in the skill description. Undocumented fund-transfer functionality in an AI-driven trading tool is especially dangerous because it enables direct asset movement beyond normal trading actions, creating severe theft or misdirection risk if the endpoint is ever reachable.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The documented purpose is a trading assistant, but the skill also includes documentation scraping and local file generation workflows unrelated to normal trade execution. This mismatch is dangerous because users and orchestrators may grant high-trust financial permissions while the skill also performs broader network retrieval and file-writing behaviors that were not clearly disclosed.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The documented purpose is a trading assistant, but the skill also includes documentation scraping and local file generation workflows unrelated to normal trade execution. This mismatch is dangerous because users and orchestrators may grant high-trust financial permissions while the skill also performs broader network retrieval and file-writing behaviors that were not clearly disclosed.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The documented purpose is a trading assistant, but the skill also includes documentation scraping and local file generation workflows unrelated to normal trade execution. This mismatch is dangerous because users and orchestrators may grant high-trust financial permissions while the skill also performs broader network retrieval and file-writing behaviors that were not clearly disclosed.

Ae1

High
Category
analysis-evasion
Content
- `references/spot-api-definitions.md` (human-readable local spot interface definitions)
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- `references/contract-api-definitions.md` (human-readable local interface definitions)
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The definitions expose a bulk close-positions endpoint that can close all open positions when no symbol is supplied, which is significantly more destructive than routine order placement or query behavior. In an automated trading skill, this creates a high-risk footgun: a prompt misunderstanding, malicious instruction, or tool misuse could liquidate a user's trading strategy across the whole account in one action.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The skill metadata describes a trading assistant for spot/futures order placement, cancellation, market data, and account retrieval, but the referenced API surface also includes affiliate intelligence and money-movement features. This creates an undocumented expansion of privilege and purpose, increasing the chance that a user or downstream agent could invoke sensitive partner-only functions without informed consent or appropriate guardrails.

Context-Inappropriate Capability

High
Confidence
97% confidence
Finding
The affiliate/referral endpoints expose sensitive business intelligence and third-party user data such as invited-user UIDs, KYC status, deposits, trades, commissions, and asset balances. In the context of a trading assistant, these capabilities are unrelated to the stated purpose and broaden access to non-user financial and identity data, raising privacy, insider-data, and misuse concerns.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
The internal withdrawal endpoint enables authenticated transfer of funds between users/accounts, which is materially more dangerous than ordinary trading operations and is not justified by the stated skill purpose. In an agent setting, a misunderstood natural-language instruction, prompt injection, or over-broad tool access could trigger unauthorized asset movement with immediate financial loss.

Missing User Warnings

High
Confidence
98% confidence
Finding
The internal withdrawal endpoint moves funds between users/accounts, yet the documentation lacks strong warnings about irreversible financial consequences and cross-user transfer risk. In the context of an agent-accessible skill, this omission is especially dangerous because users may not realize that a natural-language request could initiate direct asset transfer rather than merely retrieve data or manage orders.

Session Persistence

Medium
Category
Rogue Agent
Content
Access to private endpoints (such as account and trading APIs) requires a Weex API Key.Public market data endpoints are available without authentication.

### Create an API Key

1. Go to [API Management](https://www.weex.com/account/newapi/)
2. Create a new API key
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.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The README encourages natural-language order placement and cancellation for live trading actions without clearly requiring an explicit confirmation step or prominently warning about financial loss risk. In an agent-driven environment, this increases the chance of unintended or ambiguous prompts causing real account-affecting trades.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill exposes capabilities involving environment variables, file access, and network access but does not declare any explicit tool scope or permission boundaries. In a trading skill, this increases the chance that an agent can access secrets, write local files, or make outbound requests beyond what a user would reasonably expect, which weakens containment and auditability.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The safety policy states that direct live execution is the default flow and only requires `--confirm-live`, without an explicit warning about financial loss, irreversible execution, or the need for a safer dry-run/review path. In a trading context, this materially raises the risk of accidental or manipulated order placement causing immediate financial harm.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The documented contract API surface includes authenticated state-changing account actions such as changing margin mode, updating leverage, adjusting isolated margin, and toggling auto-append margin. These capabilities exceed a narrow interpretation of simple order placement/cancellation/query and increase the blast radius of prompt mistakes or misuse, because they can materially alter risk settings and account exposure without directly placing an order.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The transaction section documents multiple destructive authenticated endpoints—order cancellation, batch cancellation, cancel-all, conditional-order cancellation, and position closure—without any embedded warning, approval flow, or confirmation guidance. In a natural-language trading agent, absence of explicit safety interlocks makes these operations more dangerous because ambiguous or adversarial prompts can directly trigger irreversible account actions.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This documentation exposes numerous authenticated, account-impacting trading actions such as place order, close positions, and cancel all orders, including especially dangerous variants where omitting a symbol affects all positions or all open orders. In an agent skill advertised for natural-language trading, documenting destructive operations without explicit confirmation/warning requirements materially increases the risk that an LLM-driven workflow could execute irreversible or financially harmful actions from ambiguous, mistaken, or injected prompts.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The documented spot skill includes affiliate and rebate endpoints, including fund-movement and referral-data features, that exceed the stated purpose of natural-language trading, cancellation, market data, and account retrieval. This scope expansion increases the attack surface and may let an agent invoke sensitive capabilities users would not reasonably expect from a trading-focused skill.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The documentation presents destructive financial operations such as order placement, cancellation, and transfer-like capabilities without emphasizing that they can cause immediate monetary impact or be difficult to reverse. In a natural-language agent workflow, missing warnings materially increases the chance of accidental execution from ambiguous or manipulated prompts.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The cancel-all-by-symbol operation can cancel multiple active orders, but the documentation does not clearly warn about the breadth of impact. In an automated trading skill, users may interpret a request as affecting one order while the endpoint actually removes an entire symbol's open book, causing unintended trading disruption or opportunity loss.

Context-Inappropriate Capability

Medium
Confidence
90% confidence
Finding
Referral verification and affiliate user-data retrieval expose third-party financial and identity-related information that is unrelated to the skill's declared trading purpose. This creates unnecessary privacy and data-minimization risk, especially if an agent can query affiliate UIDs, KYC status, deposits, trades, or related referral metadata without users understanding that such data access exists.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
The setup instructions specify `export WEEX_LOCALE="en-US"` as a fixed configuration value. This may violate language/locale policy because it directs users to use a specific locale without offering a choice or explaining why that locale is required.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
The documentation instructs users to export `WEEX_LOCALE="en-US"` as part of the standard setup. This imposes a specific language/locale choice without opt-in or explanation, which is a natural-language policy concern under the locale policy rule.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The file sets DEFAULT_LOCALE to "en-US", and request headers use that locale unless the caller explicitly overrides it. This creates a default language/locale preference baked into the skill without any documented user opt-in or region-specific justification.

Static analysis

No suspicious patterns detected.