Back to skill

Security audit

X2c Publish

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly transparent about publishing to X2C, but it also enables real wallet operations and sends the API key to a configurable endpoint without enough guardrails.

Review before installing. Use a narrowly scoped X2C API key, pin X2C_API_BASE_URL to the official HTTPS API origin, and do not run claim, swap, or withdrawal commands unless the agent shows the amount, asset, destination address, and API origin for explicit approval immediately before execution.

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:44
Finding
Configurable API Endpoint Can Exfiltrate the X2C API Key<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 44–55 **Vulnerability Type**: Unvalidated destination for authenticated API requests **Risk Level**: High ### Vulnerable Code ```markdown ### API Endpoint All requests go to the X2C Open API. The base URL is configured via `X2C_API_BASE_URL` env var or defaults to the production endpoint. Headers: - `Content-Type: application/json` - `X-API-Key: <your_x2c_api_key>` ### Get Categories ```bash curl -m 60 -X POST "$X2C_API_BASE_URL" \ -H "Content-Type: application/json" \ -H "X-API-Key: $X2C_API_KEY" \ -d '{"action": "distribution/categories", "lang": "zh-CN"}' ``` ``` The same pattern is repeated for the distribution and wallet API operations at lines 62–65, 89–92, 112–115, 124–127, 139–142, 150–153, 160–163, 170–173, 180–183, and 191–194. ### Technical Analysis The Skill obtains the destination URL directly from the configurable `X2C_API_BASE_URL` environment variable and attaches the sensitive `X2C_API_KEY` header to requests sent to that destination. No hostname, scheme, port, or origin validation is specified. Although the documentation claims that the variable defaults to a production endpoint, the reviewed project does not define a concrete default URL or enforce an approved origin. Consequently, an attacker who can influence the Agent's environment or Skill configuration can redirect authenticated requests to an attacker-controlled server. This is a credential-exfiltration flaw caused by combining an untrusted or insufficiently constrained endpoint with a sensitive authentication header. ### Attack Path 1. An attacker gains the ability to influence environment variables or the OpenClaw Skill configuration. 2. The attacker sets `X2C_API_BASE_URL` to an HTTPS endpoint under their control. 3. A user asks the Agent to perform a documented distribution or wallet operation. 4. The Agent follows the Skill instructions and executes `curl` against the attacker-controlled URL. ...[truncated 1019 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Pin the official API origin** - Define the exact production HTTPS endpoint in the Skill. - Do not allow an arbitrary environment variable to determine where authentication credentials are sent. 2. **Apply a strict origin allowlist** - If endpoint configuration is required for staging or regional deployments, parse the URL and verify its normalized scheme, hostname, and port against a fixed allowlist. - Permit HTTPS only. - Reject user information, fragments, unexpected ports, IP literals, and deceptive subdomains. 3. **Fail closed** - Abort the operation if `X2C_API_BASE_URL` is missing, malformed, or not explicitly approved. - Do not silently send the key to an unknown destination. 4. **Protect credentials across redirects** - Do not enable unrestricted redirect following. - If redirects must be supported, verify each redirect target against the same origin allowlist before forwarding authentication headers. 5. **Reduce credential privileges** - Use short-lived, narrowly scoped credentials. - Separate content-publication permissions from wallet and withdrawal permissions. - Avoid using one API key for both low-risk queries and irreversible financial operations. 6. **Require confirmation for financial mutations** - Require explicit user confirmation immediately before claims, swaps, and withdrawals. - Display the amount, asset, destination address, and approved API origin before execution. 7. **Add operational safeguards** - Redact API keys from logs and error output. - Rotate any key that may have been used while the endpoint configuration was untrusted. - Add tests confirming that credentials cannot be sent to non-allowlisted hosts. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

External Transmission

Medium
Category
Data Exfiltration
Content
## Critical Rules

- Complete ALL workflow steps in order — never skip steps
- Always add timeout to curl commands: `-m 60`
- NEVER retry failed requests — report error and ask user
- Check project status before publishing to avoid duplicates
- Cover URL must be an image (jpg/png/webp), never a video URL
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
### Query Status

```bash
curl -m 60 -X POST "$X2C_API_BASE_URL" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $X2C_API_KEY" \
  -d '{"action": "distribution/query", "project_id": "uuid"}'
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill documents wallet operations such as claim, swap, and withdraw without requiring explicit user confirmation, risk disclosure, or warnings that these actions may be irreversible and transfer real assets. In an agent setting, this increases the chance of accidental financial loss, unauthorized withdrawals, or users invoking sensitive actions without understanding the consequences.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The Get Categories example hard-codes `"lang": "zh-CN"` in the request, which imposes a specific locale in the skill instructions. The file does not offer a user choice or explain that the locale is region-specific and justified, so this is a natural-language policy violation under the language/locale rule.

Static analysis

No suspicious patterns detected.