Back to skill

Security audit

OpenClaw Config Safety v2

Security checks for vulnerabilities and agentic risk

Overview

The skill is for OpenClaw config safety, but several implementation gaps could expose credentials or unexpectedly change a live configuration.

Review before installing. Do not treat exported `mrconf:v1` tokens as safe to share unless you have verified the decoded payload contains no plaintext secrets. Avoid running the validator or import/normalize flows against important configs without a backup and manual review, because the current scripts may modify live OpenClaw configuration unexpectedly.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
src/export.js:21
Finding

Shareable configuration tokens can disclose plaintext credentials

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
src/normalize.js:202
Finding

Normalization silently deletes protected configuration fields

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/validate-openclaw-config.sh:229
Finding

Pre-write validation may run a fixing command against the live configuration

Content
View full analysis
&1) || DOCTOR_EXIT=$? echo "$DOCTOR_OUTPUT" | head -20 ``` ### Technical Analysis The script creates a temporary copy of the candidate configuration, but it does not connect that file to the `openclaw doctor` process: - `OPENCLAW_CONFIG` is not set to the temporary file. - The command is not executed with the temporary directory as its working directory. - No candidate path is passed as an argument. - The command includes `--fix`, which is explicitly capable of modifying configuration. Therefore, the OpenClaw process may resolve its normal default configuration path and apply fixes to the live user configuration instead of validating the candidate copy. The temporary copy provides no isolation. This behavior violates the stated pre-write model because an operation presented as validation can perform writes before the candidate is accepted. Unlike the JavaScript doctor wrapper, the shell script does not provide the candidate through `OPENCLAW_CONFIG`. ### Attack Path 1. A user prepares a candidate configuration and invokes `validate-openclaw-config.sh --file candidate.json`. 2. The script copies the candidate into a temporary directory. 3. The temporary path is never supplied to OpenClaw. 4. The script invokes `openclaw doctor --fix --non-interactive`. 5. OpenClaw resolves its normal default configuration, potentially `~/.openclaw/openclaw. ...[truncated 838 chars]
Remediation
View remediation
&1 ) || DOCTOR_EXIT=$? ``` 3. If OpenClaw requires a particular working directory, execute the command in the isolated directory in addition to setting `OPENCLAW_CONFIG`. 4. Use a sanitized environment containing only variables required for validation. 5. Hash the live configuration before and after validation and fail loudly if it changes. 6. Add an integration test with distinct live and candidate files. Assert that: - The candidate is the file examined. - The live configuration remains byte-for-byte unchanged. 7. If a fixing operation is genuinely required, make it a separate, clearly named, opt-in command with: - An automatic backup. - Explicit user confirmation. - Post-write validation. - Automatic rollback on failure. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
src/doctor-check.js:45
Finding

Predictable temporary directory enables local symlink and file-manipulation attacks

Content
View full analysis
` before the victim invokes `runDoctor`. 3. The attacker makes the directory accessible and places an `openclaw.json` symbolic link pointing to an attacker-selected path. 4. The victim invokes `runDoctor` on a sensitive configuration. 5. `mkdirSync(..., { recursive: true })` accepts the pre-existing directory. 6. `copyFileSync` writes through the attacker-controlled destination entry. 7. Depending on the target, the attacker obtains a copy of the configuration or causes the victim to overwrite another file writable by the vic ...[truncated 757 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (28)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `EXPORT-TOKEN-SPEC.md` — token format spec

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module-level security claim says resolved credential values are never logged or exposed, but the implementation resolves credential references and returns the substituted config object to the caller. This creates a confidentiality risk because downstream code may treat the returned object as non-sensitive and log, serialize, or transmit secrets based on the misleading contract.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · src/normalize.js (reported line 216)May include surrounding context.

js
const childPath = fieldPath ? `${fieldPath}.${key}` : key;

    // Skip env subtrees (opaque)
    if (childPath.endsWith(".env") || childPath === "env") continue;

    // Skip secret:// refs (opaque) — preserve as-is, don't recurse
    if (isString(val) && val.startsWith("secret://")) {

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · src/prompt.js (reported line 75)May include surrounding context.

js
// Sync versions for non-TTY contexts
function promptYesNoSync(question, defaultYes = false) {
  if (!process.stdin.isTTY) return false;
  return promptYesNo(question, defaultYes);
}

function promptTextSync(question, defaultValue = "") {

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · src/prompt.js (reported line 80)May include surrounding context.

js
// Sync versions for non-TTY contexts
function promptYesNoSync(question, defaultYes = false) {
  if (!process.stdin.isTTY) return false;
  return promptYesNo(question, defaultYes);
}

function promptTextSync(question, defaultValue = "") {

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · test/normalize.test.js (reported line 308)May include surrounding context.

js
env: { NODE_ENV: "production", API_KEY: "super-secret" },
});
assertEqual(result.normalized.env, undefined, "env subtree stripped from output (handled specially)");
// Note: env subtree should be passed through, not stripped. Let me check... Actually in normalizeValue, the .env key is handled specially. Let me verify the actual behavior.

// ─── Security: no value exposure in warnings ─────────────────────────────────

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The trigger list is very broad for a high-impact configuration skill, covering generic phrases like config edit, validation, imports/exports, updates, and restart-related tasks. Overbroad activation can cause the skill to engage in situations outside its narrowly intended scope, increasing the chance that an agent applies config-changing guidance unnecessarily or in the wrong context.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
Exit codes: 0 = success, 1 = failure, 2 = invalid arguments.

### `validate-openclaw-config.sh` — Pre-write validator

Run before any direct edit to openclaw.json:

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/CONFIG-EDIT.md (reported line 3)May include surrounding context.

md
# Protocol: openclaw.json Config Edits

**Applies to:** Any write to `~/.openclaw/openclaw.json` — direct edit, scripted update, doctor --fix auto-commit, config token import.

**Why this exists:** Without a pre-write gate, invalid fields (e.g. `status`, `note` in per-model overrides — fields outside the Zod schema) cause gateway crashes. The validator and wizard are the safety net.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The spec contains a security-significant contradiction: it claims imports are validated before substitution, but the documented flow actually resolves credentials and substitutes ${REF} values into the config before the final schema validation. If any downstream logic, normalization, logging, or provider-specific parsing touches substituted values prior to strict validation, malformed or attacker-controlled token content could trigger unsafe behavior or leak secrets despite the stated security model.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/ONBOARDING-SPEC.md (reported line 130)May include surrounding context.

5. Export Token (opt-in)

Offer to create an export token:

text
🔐 Export Token

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The non-interactive --import <token> mode is specified to replace the current config without any confirmation, even though the document elsewhere acknowledges import is destructive. In automation or when invoked by another tool, this can allow silent configuration replacement, causing denial of service, unsafe reconfiguration, or unexpected agent behavior if an untrusted token is supplied.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/ONBOARDING-SPEC.md (reported line 286)May include surrounding context.

md
---

## Post-Write Verification

After any write to `openclaw.json`:

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The credential-handling section states the wizard 'Only validates' that ${REF} placeholders are present in the config, which implies no secret resolution behavior. The very next line says that on import it resolves references from environment variables or pass, which is a materially different and more powerful operation than mere presence validation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/ONBOARDING-SPEC.md (reported line 336)May include surrounding context.

md
- `src/audit.js` — config summary generator
- `src/prompt.js` — TTY prompt helpers (yes/no, text input, menu)
- `src/config-patch.js` — safe config merge for import
- `src/doctor-check.js` — post-write `openclaw doctor` wrapper
- `src/restore-backup.js` — backup + restore helpers
- `test/onboard.test.js` — non-interactive edge cases
- `test/audit.test.js` — audit output format tests

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script advertises pre-write validation, but later runs openclaw doctor --fix, which is a mutating operation. In a validation context, invoking an auto-fix command can unexpectedly alter files or state, violating the safety boundary between 'check' and 'write' and creating integrity risks, especially in automation or CI where users may trust this script to be side-effect free.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file promises read-only behavior, but generateAudit passes the caller-supplied config into normalizeOpenClawConfig without defensive cloning. If the normalizer mutates its input, this function can unexpectedly alter live configuration state while only intending to produce an audit summary, creating integrity and trust-boundary issues for callers that rely on non-mutating inspection.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module header describes behavior limited to running openclaw doctor on a candidate config file after normalization/import. However, the same file also defines restartGateway() and isGatewayUp(), which perform operational gateway control and health probing rather than config validation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The docstring for exportConfigToken states it returns an object with token and credentialRefs, but the implementation returns only a string token (mrconf:v1:...). This is an active contradiction between documented intent and actual behavior, not merely an omitted detail.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The inline documentation at L229 says custom plugin config blobs are 'pass through untouched', which implies no traversal or modification. However, L231-L232 explicitly recurse into plugin config objects via normalizeValue, allowing nested normalization behavior; this is an active contradiction rather than merely incomplete documentation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code file performs a file write that replaces the active config with backup contents, which is a potentially destructive operation. Although the module header describes backup/restore behavior, the restore path itself has no confirmation prompt or user-facing log indicating that the current config is about to be overwritten.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · test/normalize.test.js (reported line 88)May include surrounding context.

js
// baseURL trimmed
result = normalizeOpenClawConfig({
  agents: { defaults: {} },
  models: { providers: { openai: { baseURL: "  https://api.openai.com/v1  " } } },
  plugins: { entries: {} },
});
assertEqual(result.normalized.models.providers.openai.baseURL, "https://api.openai.com/v1", "baseURL trimmed");

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · test/normalize.test.js (reported line 91)May include surrounding context.

js
// baseURL trimmed
result = normalizeOpenClawConfig({
  agents: { defaults: {} },
  models: { providers: { openai: { baseURL: "  https://api.openai.com/v1  " } } },
  plugins: { entries: {} },
});
assertEqual(result.normalized.models.providers.openai.baseURL, "https://api.openai.com/v1", "baseURL trimmed");

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The test at L307 asserts result.normalized.env is undefined, meaning the code expects the env subtree to be removed from normalized output. The following inline note at L308 explicitly says the env subtree should be passed through, which directly contradicts the asserted behavior and documents conflicting intent.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

This section states alias handling is informational only, yet the sample input alias deepseek-r1-distill-qwen-32b does not match the listed known aliases for the canonical model, which are deepseek-r1-32b and deepseek-r1. That inconsistency can cause implementers to infer normalization or mapping behavior not supported by the stated alias table.

Content

No source excerpt is available for this finding.