Back to skill

Security audit

Command Flow

Security checks for vulnerabilities and agentic risk

Overview

This is mostly a disclosed Chinese command browser, but it needs Review because it marks sensitive OpenClaw command areas as safe and includes a helper script that can generate unsafe JavaScript from local CLI output.

Review this before installing if you rely on the safety labels. Treat the dashboard as a command catalog, not as an authoritative safety gate. Be especially careful with reset, plugin, token/device, memory, message, scheduler, service, hook, and configuration commands, and do not run the command-generation helper unless you trust the openclaw binary on PATH and understand that generated JavaScript may need manual review.

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
auto-add-commands.js:58
Finding

Unescaped CLI Output Is Embedded into Generated JavaScript Source

Content
View full analysis

Vulnerability Details

File Location: auto-add-commands.js:58-69, 100-104
Vulnerability Type: Unsafe source-code generation
Risk Level: High

Vulnerable Code

javascript
function generateCommandCode(cmd) {
  return `    {
      slug: '${cmd.slug}',
      command: '${cmd.command}',
      description: '${cmd.description}',
      safety: SAFETY.SAFE,
      source: SOURCE.NATIVE,
      category: 'OpenClaw',
      executeHint: '执行命令',
      execute: async () => {
        return \`提示:请使用 OpenClaw 直接执行 \\\`${cmd.command}\\\`\n\n(此命令为系统命令)\`;
      }
    },`;
}
javascript
const code = commands.map(generateCommandCode).join('\n');

// 输出到文件
const outputPath = path.join(__dirname, 'openclaw-commands.generated.js');
fs.writeFileSync(outputPath, code, 'utf8');

The values used by this function originate from the output of a local executable:

javascript
const output = execSync('openclaw --help', { encoding: 'utf8' });

Technical Analysis

The generator interpolates command names and descriptions obtained from openclaw --help directly into JavaScript string literals. It does not escape single quotes, backslashes, template-literal metacharacters, or JavaScript line terminators before generating the source file.

Although the command-name parser restricts command names to a relatively narrow character set, the description is captured using (.+) and subsequently inserted into:

javascript
description: '${cmd.description}',

An attacker who controls which openclaw executable is resolved through PATH, or who otherwise controls its help output, can include a single quote and JavaScript syntax in a command description. That syntax will be written into openclaw-commands.generated.js.

The script does not import the generated file automatically. Its output explicitly instructs the operator to copy the generated code into commands.js, so exploitation requires the generated source to be copied, imported, or otherwise ex ...[truncated 1409 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not generate executable JavaScript from command output. Store generated command metadata as JSON and load it as data.
  2. Serialize every externally derived value with JSON.stringify() rather than manually placing it between quotes.
  3. Enforce strict validation and length limits on descriptions, command names, categories, and other generated fields.
  4. Resolve openclaw to an expected absolute path and verify that the executable is trusted before running it.
  5. Prefer execFileSync() with an absolute executable path and an argument array:
    javascript
    execFileSync(trustedOpenClawPath, ['--help'], {
      encoding: 'utf8',
      shell: false
    });
    
  6. If JavaScript generation is unavoidable, generate object data using a trusted serializer rather than template interpolation:
    javascript
    const serialized = JSON.stringify(commandMetadata, null, 2);
    
  7. Remove the workflow that asks users to copy generated source manually. Use a validated data import path instead.
  8. Add tests containing quotes, backslashes, newlines, Unicode separators, and attempted JavaScript payloads to verify that all generated values remain inert data.

T09 · Insecure Skill Coding Practices

Warning
Location
commands.js:483
Finding

Destructive and Security-Sensitive Commands Are Incorrectly Classified as Safe

Content
View full analysis

Vulnerability Details

File Location: commands.js:483-491
Vulnerability Type: Incorrect security classification and missing confirmation control
Risk Level: Medium

Vulnerable Code

javascript
{
  slug: 'reset',
  command: '/reset',
  description: '重置本地配置/状态',
  safety: SAFETY.SAFE,
  source: SOURCE.NATIVE,
  category: 'OpenClaw',
  executeHint: '执行命令',
  execute: async () => {
    return `提示:请使用 OpenClaw 直接执行 \`/reset\`\n\n(此命令为系统命令)`;
  }
},

The same registry also categorizes several broad management commands as safe, including command surfaces for scheduled tasks, services, device and token management, hooks, memory, messages, nodes, and plugins.

Technical Analysis

The Skill advertises risk classification and mandatory confirmation for dangerous operations. However, /reset, which is explicitly described as resetting local configuration or state, is assigned SAFETY.SAFE. It has no confirm flag or confirmation message.

The handler does not perform the reset itself, but it directs the user to invoke /reset through OpenClaw. Consequently, the green safe classification can influence a user to execute a potentially destructive command without receiving the warning promised by the Skill.

Several other entries represent broad command groups whose subcommands may modify persistent configuration, manage credentials or tokens, install plugins, create scheduled jobs, control services, or send messages. Assigning safety at only the top-level command name fails to account for the effects of individual subcommands.

Attack Path

  1. A user opens the command catalog and relies on its advertised safety labels.
  2. The catalog presents /reset with the safe classification.
  3. No confirmation requirement or destructive-operation warning is displayed.
  4. The handler instructs the user to execute /reset directly through OpenClaw.
  5. The user invokes the command under the mistaken assumption that it is non-destructive.
  6. Dependin ...[truncated 918 chars]
Remediation
View remediation

Remediation Suggestions

  1. Change /reset from SAFETY.SAFE to SAFETY.WARNING or SAFETY.HIDDEN, according to its actual destructive scope.
  2. Add explicit confirmation metadata:
    javascript
    safety: SAFETY.WARNING,
    confirm: true,
    confirmMessage: 'Resetting local configuration or state may be irreversible. Continue?'
    
  3. Display the exact resources affected before asking for confirmation.
  4. Classify individual subcommands rather than assigning one safety level to an entire command family.
  5. Treat operations that alter configuration, credentials, tokens, plugins, services, scheduled tasks, messages, or persistent state as warning or hidden by default.
  6. Require confirmation immediately before execution, not merely when the command is first displayed.
  7. Ensure that UI integrations cannot bypass the confirmation state by directly filling or forwarding a command.
  8. Add tests that verify every destructive or privileged command is excluded from the safe category and cannot proceed without explicit user approval.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (17)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The tagline explicitly states '中文解释' as the interaction mode, which imposes a specific language rather than offering language selection. Under the policy, forcing a locale or language without opt-in is a natural-language policy violation unless it is clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description explicitly centers the skill on Chinese explanations ("中文解释") and later states "让你说中文,就能用 OpenClaw" without offering any language choice. This is a natural-language locale policy concern because the skill presents a fixed language mode rather than an opt-in or configurable locale.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes very broad phrases such as “所有命令”, “命令列表”, “下一页”, and “上一页”, plus generic symbols like “//”, which can appear in normal conversation or unrelated contexts. This creates a real risk of accidental skill activation, causing the assistant to intercept user intent unexpectedly and potentially expose or initiate command-related workflows the user did not explicitly request.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The marketing language encourages users to invoke functionality with natural free-form Chinese speech like “随口一说就懂,” without clearly defining activation boundaries. In a command-dispatch skill, that ambiguity increases the chance that ordinary language is interpreted as a command request, which can lead to unintended command discovery or execution flows.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level documentation says 'Auto-Add OpenClaw Commands to commands.js', implying the script will directly modify commands.js. In reality, the code writes to 'openclaw-commands.generated.js' and merely prints instructions to manually copy the generated code into commands.js, which contradicts the stated behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code defines nearly all user-facing command descriptions, warnings, hints, confirmations, and test output in Chinese, which effectively forces a specific language for interaction. The file does not provide any opt-in, fallback, or documentation indicating that the skill is intentionally limited to a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The top-level documentation says the system can '显示命令列表、搜索命令、执行命令' (display, search, and execute commands). In this file, every exported function only formats or returns command metadata, and the CLI routes only to show/search/export views; no command execution path is implemented here, only UI labels like '[执行]'.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Comments and especially user-facing strings throughout the file present the dashboard entirely in Chinese, and the CLI/help output also assumes Chinese-language interaction. The file does not provide any opt-in, fallback, or documented justification for enforcing a single language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The exported markdown hard-codes the locale to 'zh-CN' via toLocaleString('zh-CN'), which forces a specific locale regardless of user preference. This is a natural-language/locale policy issue because the file does not offer a language or locale choice or document a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This JavaScript file embeds user-facing command guidance in Chinese, such as the executeHint and returned prompt text, while the surrounding command descriptions are in English. That creates a locale policy concern because the skill presents a fixed language to users without any visible opt-in, language selection, or documented region-specific justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The inline metadata presents /agent as a command that will 'Run one agent turn via the Gateway', but the implementation does not perform that action and instead only returns an instruction string. This is an active contradiction between the documented intent in the command entry and the code behavior, and the same pattern appears throughout the file for other commands.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
85% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · openclaw-commands.generated.js (reported line 522)May include surrounding context.

js
{
      slug: 'skills',
      command: '/skills',
      description: 'List and inspect available skills',
      safety: SAFETY.SAFE,
      source: SOURCE.NATIVE,
      category: 'OpenClaw',

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This JavaScript file contains natural-language comments and user-facing strings in Chinese, including descriptions and prompts, without indicating that the user can choose a language or that the skill is region-specific. Under the language/locale policy, forcing a specific language without user opt-in is a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The fallback confirmation message '确定要执行吗?' is a user-facing prompt fixed to Chinese and provides no mechanism for language selection. This can violate language/locale policy when users are not given an explicit opt-in or alternative locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generated help text returned by generateAskText is entirely in Chinese and appears intended for end users, but the file provides no user opt-in or configurable locale support. That makes the skill's interface effectively force a single language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s comments and generated user-facing output are written exclusively in Chinese, including labels shown in Telegram and CLI output. This imposes a specific language on users without any visible opt-in, fallback, or indication that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This JavaScript file contains natural-language comments and console output entirely in Chinese, including operational status and error messages shown to the user. The policy requires flagging language or locale constraints when the skill forces a specific language without opt-in, and there is no indication that this tool is intentionally limited to Chinese-speaking users.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
auto-add-commands.js:18

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
sync-commands.js:18