Back to skill

Security audit

Agent Config Validator

Security checks for vulnerabilities and agentic risk

Overview

The main validator is mostly scoped and user-directed, but the package ships a vulnerable test runner and can persistently edit OpenClaw agent configuration, so it belongs in Review before installation.

Install only if you intend to let this skill inspect your OpenClaw agent tree and, when explicitly run with fix options, modify .openclaw/openclaw.json. Prefer read-only or dry-run first, keep safe mode enabled, review backups before accepting changes, and do not run test-skill.js with an untrusted OPENCLAW_ROOT value.

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
test-skill.js:9
Finding

Shell Command Injection Through OPENCLAW_ROOT

Content
View full analysis

Vulnerability Details

File Location: test-skill.js, lines 9–24
Vulnerability Type: OS command injection caused by constructing a shell command with an environment-controlled path
Risk Level: High

Vulnerable Code

javascript
const { execSync } = require('child_process');
const path = require('path');

// Get OpenClaw root directory
const openclawRoot = process.env.OPENCLAW_ROOT || 'D:\\OpenClaw';
const validatorPath = path.join(openclawRoot, '.openclaw', 'skills', 'agent-config-validator', 'src', 'validator.js');

console.log('🧪 Agent Config Validator - OpenClaw integration test\n');
console.log(`OpenClaw root directory: ${openclawRoot}`);
console.log(`Validator path: ${validatorPath}\n`);

try {
    // Run validator
    const result = execSync(
        `node "${validatorPath}" --verbose`,
        {
            cwd: openclawRoot,
            encoding: 'utf-8',
            stdio: 'inherit'
        }
    );

Technical Analysis

The script reads OPENCLAW_ROOT from the process environment and uses it to build validatorPath. It then interpolates that path into a command string passed to child_process.execSync().

By default, execSync() executes command strings through a system shell. Consequently, shell metacharacters embedded in the environment-controlled path may be interpreted as command syntax rather than as part of a literal filename. Wrapping the path in double quotes does not provide reliable security because an attacker may inject quote characters and platform-specific shell operators to terminate the quoted argument and append another command.

path.join() only constructs and normalizes a filesystem path. It does not escape input for use in a shell command and therefore does not prevent this vulnerability.

Exploitation requires the attacker to control or influence OPENCLAW_ROOT in the environment of a process that runs test-skill.js.

Attack Path

  1. An attacker gains control of the OPENCLAW_ROOT environ ...[truncated 1348 chars]
Remediation
View remediation

Remediation Suggestions

Eliminate shell interpretation by invoking Node.js with a fixed executable and a separate argument array:

javascript
const { execFileSync } = require('child_process');
const path = require('path');
const fs = require('fs');

const openclawRoot = path.resolve(
    process.env.OPENCLAW_ROOT || 'D:\\OpenClaw'
);

const validatorPath = path.join(
    openclawRoot,
    '.openclaw',
    'skills',
    'agent-config-validator',
    'src',
    'validator.js'
);

if (!fs.existsSync(validatorPath)) {
    throw new Error(`Validator not found: ${validatorPath}`);
}

execFileSync(
    process.execPath,
    [validatorPath, '--verbose'],
    {
        cwd: openclawRoot,
        encoding: 'utf-8',
        stdio: 'inherit',
        shell: false
    }
);

Additional hardening measures:

  1. Resolve the configured root with path.resolve() before use.
  2. Verify that the root and validator file exist and have the expected file types.
  3. If the deployment has a known trusted OpenClaw directory, enforce that the resolved path remains within it.
  4. Do not attempt to solve the issue with manual shell escaping; avoiding the shell is more robust and portable.
  5. Restrict who can set environment variables in CI jobs, scheduled tasks, and service definitions that execute the test script.
  6. Add a regression test using paths containing spaces, quotes, and shell metacharacters to ensure they are handled strictly as arguments.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (14)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · src/validator.js (reported line 855)May include surrounding context.

js
const args = process.argv.slice(2);
    const fix = args.includes('--fix') || args.includes('-f');
    const verbose = args.includes('--verbose') || args.includes('-v');
    const safeMode = !args.includes('--safe-mode=false') && !args.includes('--no-safe-mode');
    const confirmSensitive = args.includes('--confirm-sensitive') || args.includes('-c');
    const dryRun = args.includes('--dry-run') || args.includes('-d');

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The line 'Read-only mode by default, never modifies anything' is internally contradicted by surrounding documentation that describes backup creation before modifications, auto-repair modes, and write failures when saving config files. This is not merely incomplete wording; it incorrectly states an absolute no-modification property while the documented behavior clearly includes optional file modification.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
84% confidence
Finding

Documenting and exposing a --safe-mode=false option lowers safety guarantees by allowing non-whitelisted repairs, which increases the chance of unintended or overly broad configuration changes. In a tool that can edit agent configuration, this expands the attack surface for misuse, operator error, or unsafe automation if the flag is invoked without strong guardrails.

Content

Scanner excerpt · README-en.md (reported line 66)May include surrounding context.

md
|--------|-------|-------------|
| `--fix` | `-f` | Enable auto-repair |
| `--safe-mode` | | Only repair whitelist items (enabled by default) |
| `--safe-mode=false` | | Allow repairing non-whitelist items |
| `--confirm-sensitive` | `-c` | Sensitive changes require confirmation |
| `--dry-run` | `-d` | Dry run mode |
| `--verbose` | `-v` | Verbose output |

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
88% confidence
Finding

The README documents an option to disable safe mode (--safe-mode=false), which weakens the tool's protective default and enables non-whitelisted automatic fixes. In a configuration-management skill that can modify project state, this increases the risk of unintended or overbroad changes, especially if users copy commands from the documentation without fully understanding the safety implications.

Content

Scanner excerpt · skills/agent-config-validator/README.md (reported line 66)May include surrounding context.

md
|------|------|------|
| `--fix` | `-f` | 启用自动修复 |
| `--safe-mode` | | 仅修复白名单项(默认启用) |
| `--safe-mode=false` | | 允许修复非白名单项 |
| `--confirm-sensitive` | `-c` | 敏感变更需要确认 |
| `--dry-run` | `-d` | 试运行模式 |
| `--verbose` | `-v` | 详细输出 |

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description is written as a Chinese-only user-facing description and does not indicate that other languages are supported or that the locale is optional. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy concern unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Core operational instructions, warnings, and examples are written in Chinese throughout the skill file, but the document does not offer a language choice or explain a necessary locale constraint. This can violate organizational language/locale policy when users are not given an explicit option to use another language.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · src/validator.js (reported line 629)May include surrounding context.

js
// 4. 报告跳过的项目
        if (skippedCount > 0) {
            console.log(`\n⏭️  安全模式下跳过 ${skippedCount} 个非白名单修复项`);
            console.log(`   使用 --safe-mode=false 允许修复所有可修复项`);
        }

        return { fixCount, skippedCount };

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · src/validator.js (reported line 855)May include surrounding context.

js
// 4. 报告跳过的项目
        if (skippedCount > 0) {
            console.log(`\n⏭️  安全模式下跳过 ${skippedCount} 个非白名单修复项`);
            console.log(`   使用 --safe-mode=false 允许修复所有可修复项`);
        }

        return { fixCount, skippedCount };

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The package description is written entirely in Chinese, which imposes a specific language on users without indicating any language choice or opt-in. The policy for natural-language violations applies to all file types, including manifest files like package.json.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description and usage guidance are presented in Chinese, but the document does not indicate that the language is optional or that the skill is intended only for a Chinese-speaking audience. This can violate a language/locale policy when users are not given an explicit opt-in or alternative language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This manifest contains a user-facing description entirely in Chinese, but provides no indication that the skill is region-specific or that other language options are available. Under the natural-language policy check, this can be considered a locale/language constraint without documented opt-in or justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest describes a validator for checking consistency between openclaw.json and core agent documents, plus optional repair. Reading process.env.OPENCLAW_ROOT introduces an additional capability to inspect process environment state, which is not necessary to perform validation when an explicit path or working-directory discovery would suffice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The report timestamp is always formatted with toLocaleString('zh-CN'), which imposes a specific locale in user-facing output. This is a natural-language/locale policy concern because the user is not offered a language or locale choice, and no region-specific justification is provided in the file.

Content

No source excerpt is available for this finding.