Back to skill

Security audit

x-search-oauth

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent X/Twitter search wrapper, but its CLI can expose a gateway token through command-line arguments and forward it to an arbitrary gateway URL.

Review before installing if you plan to use the CLI with custom gateway credentials. Prefer OpenClaw's normal OAuth setup, avoid putting tokens directly in shell commands, and do not combine --gateway-token with an untrusted --gateway-url. The core x_search use appears purpose-aligned, but the credential override path needs caution.

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

Warning
Location
src/cli.js:92
Finding
Gateway Token Exposed Through Process Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `src/cli.js`, lines 59-60 and 90-98 **Vulnerability Type**: Credential exposure through process arguments and unsafe endpoint override **Risk Level**: Medium ### Vulnerable Code ```js else if (arg === "--gateway-url") parsed.gatewayUrl = next(); else if (arg === "--gateway-token") parsed.gatewayToken = next(); ``` ```js function buildGatewayArgs(options) { const toolArgs = { query: options.query, ...(options.allowedXHandles.length ? { allowed_x_handles: options.allowedXHandles } : {}), ...(options.excludedXHandles.length ? { excluded_x_handles: options.excludedXHandles } : {}), ...(options.fromDate ? { from_date: options.fromDate } : {}), ...(options.toDate ? { to_date: options.toDate } : {}), ...(options.enableImageUnderstanding ? { enable_image_understanding: true } : {}), ...(options.enableVideoUnderstanding ? { enable_video_understanding: true } : {}) }; return ["gateway", "call", "tools.invoke", "--json", "--timeout", String(options.timeoutMs), "--params", JSON.stringify({ name: "x_search", args: toolArgs }), ...(options.gatewayUrl ? ["--url", options.gatewayUrl] : []), ...(options.gatewayToken ? ["--token", options.gatewayToken] : [])]; } function runOpenClaw(spawn, env, args, options = {}) { const bin = options.openclawBin || env.X_SEARCH_OAUTH_OPENCLAW_BIN || "openclaw"; const result = spawn(bin, args, { encoding: "utf8", env, stdio: options.inherit ? "inherit" : "pipe", timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS }); return { status: result.status ?? (result.error ? 1 : 0), stdout: result.stdout ?? "", stderr: result.stderr ?? "", error: result.error }; } ``` ### Technical Analysis The CLI accepts a sensitive OpenClaw gateway token through `--gateway-token`. This exposes the token in the wrapper process's command-line arguments. The implementation then inserts the same token into the argument array used to launch the `openclaw` child process, exposing it a second time. Depending ...[truncated 2492 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `--gateway-token` option so secrets are not accepted through command-line arguments. 2. Prefer OpenClaw's native credential configuration or an operating-system credential store. 3. If explicit token injection is necessary, read it from protected standard input, a dedicated file with restrictive permissions, or another secret-delivery channel that does not expose it in process arguments. 4. Avoid forwarding tokens to child processes through argument arrays. Use a supported protected authentication mechanism instead. 5. Require HTTPS for non-local gateway URLs. Explicitly reject plaintext remote HTTP endpoints. 6. Restrict gateway overrides to trusted origins or require an explicit confirmation before sending credentials to a non-local endpoint. 7. Redact token values from errors, diagnostics, telemetry, and debug output. 8. Document that users should never place secrets directly in shell commands and should not combine credentials with untrusted gateway URLs. 9. Add automated tests confirming that secret values never appear in spawned argument arrays, standard output, standard error, or formatted errors. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The invocation guidance is broad enough that the skill could be triggered for many loosely related requests about X/Twitter, trends, or monitoring, increasing the chance of over-invocation. In an agent environment, that can cause unintended access to external content and tool use when a narrower or more appropriate skill should have been selected, which expands attack surface and may expose the agent to untrusted content more often.

Missing User Warnings

Low
Confidence
77% confidence
Finding
This code file parses a sensitive credential via `--gateway-token` and later passes it to the OpenClaw subprocess, but there is no inline warning, confirmation, or comment near the handling of this secret. Although the help text documents the flag, it does not warn users that they are supplying a sensitive token on the command line, which can have visibility/privacy implications.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
src/cli.js:97