Back to skill

Security audit

OpenClaw API Control

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it advertises, but it gives an API key broad remote-control powers and can send that key and uploaded local files to an unchecked custom API endpoint.

Install only if you trust the publisher and need remote administrative control of an OpenClaw instance. Keep OPENCLAW_API_BASE_URL at the official HTTPS endpoint unless you fully trust the alternative server, use a limited-scope API key if available, and avoid upload-tree on broad directories containing .env files, keys, tokens, or private project data.

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
scripts/openclaw_api_client.mjs:8
Finding

Unrestricted API Base URL Can Expose Bearer Credentials and Uploaded Files

Content
View full analysis

Vulnerability Details

File Location: scripts/openclaw_api_client.mjs, lines 8-18, 77-89, and 196-221
Vulnerability Type: Unvalidated network destination for sensitive authenticated requests
Risk Level: High

Complete Code Snippet

js
const DEFAULT_BASE_URL = 'https://openclaw-as-a-service.com/api';
const MAX_UPLOAD_BYTES = 5 * 1024 * 1024;

function normalizeBaseUrl(rawValue) {
  const trimmed = String(rawValue || '').trim();
  if (!trimmed) {
    return DEFAULT_BASE_URL;
  }

  const withoutTrailing = trimmed.replace(/\/+$/, '');
  return withoutTrailing.endsWith('/api') ? withoutTrailing : `${withoutTrailing}/api`;
}

const API_BASE_URL = normalizeBaseUrl(process.env.OPENCLAW_API_BASE_URL);
const API_KEY = String(process.env.OPENCLAW_API_KEY || '').trim();
js
async function apiRequest(method, pathname, { query = null, body = undefined, expect = 'json' } = {}) {
  ensureApiKey();

  const url = new URL(pathname.replace(/^\//, ''), `${API_BASE_URL.replace(/\/+$/, '')}/`);
  if (query && typeof query === 'object') {
    for (const [key, value] of Object.entries(query)) {
      if (value === undefined || value === null || value === '') {
        continue;
      }
      url.searchParams.set(key, String(value));
    }
  }

  const response = await fetch(url, {
    method,
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      ...(body !== undefined ? { 'Content-Type': 'application/json' } : {})
    },
    body: body !== undefined ? JSON.stringify(body) : undefined
  });
js
for (const filePath of files) {
  const relativeFile = path.relative(absoluteSource, filePath);
  const buffer = await fs.readFile(filePath);
  if (buffer.length > MAX_UPLOAD_BYTES) {
    skipped.push({ path: filePath, reason: 'too_large' });
    continue;
  }
  if (!isLikelyTextFile(buffer)) {
    skipped.push({ path: filePath, reason: 'binary_or_unsupp
...[truncated 3860 chars]
Remediation
View remediation

Remediation Suggestions

  1. Parse the configured base URL and require https: before sending credentials.
  2. Allow the documented production hostname by default. If custom deployments must be supported, require an explicit opt-in setting and display the exact destination before transmitting the bearer token.
  3. Reject URLs containing embedded usernames or passwords, unsupported schemes, fragments, or unexpected ports.
  4. Consider maintaining a configurable hostname allowlist for managed environments.
  5. Bind credentials to approved origins and never automatically forward the bearer token across redirects to a different origin.
  6. Add default recursive-upload exclusions for .env, .git, private-key formats, cloud credential directories, token stores, and other common secret-bearing files.
  7. Support an ignore file or explicit include patterns so users can constrain recursive uploads.
  8. Present a pre-upload summary of destination host, source directory, file count, and sensitive-file warnings, then require confirmation where interactive operation is possible.
  9. Update SKILL.md to explain that custom endpoints receive the bearer token and that recursive uploads may contain secrets.
  10. Add tests confirming rejection of HTTP URLs, unexpected schemes, disallowed hosts, cross-origin redirects, and sensitive files during recursive upload.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (14)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. Use `scripts/openclaw_api_client.mjs root` or `instances list` to confirm connectivity.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill can access sensitive environment variables and perform outbound network operations, but it does not declare an explicit tool scope such as allowed-tools or permissions. That creates an authorization gap: a host agent or reviewer cannot easily enforce least privilege or verify that network and env access are intentionally limited to the documented OpenClaw API workflow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The uploadTree function recursively reads local files and sends their contents to the OpenClaw API, which can affect both user data privacy and remote system state. Although upload behavior is functionally implied by the command name, the code contains no explicit warning, confirmation, or user-facing disclosure about recursive local file transmission.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code exposes commands that write files and create directories in a remote instance via the API, but it provides no confirmation prompt, warning message, or explanatory comment/docstring before performing those state-changing actions. The usage text lists the commands, but it does not warn that they modify remote workspace contents.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This command sends arbitrary shell commands to a remote terminal execution endpoint, which is a safety-critical operation. The code does not display any warning, confirmation, or explanatory comment indicating that the provided command will be executed remotely.

Content

No source excerpt is available for this finding.