Back to skill

Security audit

OpenClaw Docs Search + Config Patterns

Security checks for vulnerabilities and agentic risk

Overview

This is an offline OpenClaw documentation helper, but it should be reviewed because some setup and command guidance is overbroad or unsafe for agent-driven configuration work.

Install only if you trust the local OpenClaw docs tree and the package dependency resolution. Keep triggers OpenClaw-specific, review any config.patch, restart, cron, heartbeat, or restore action before it runs, and avoid executing generated `cat` commands from untrusted index results unless the path is safely quoted or read through a trusted file API.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
lib/search.js:137
Finding
Shell Command Injection Through Unquoted Indexed Documentation Paths## Vulnerability Details **File Location**: `lib/search.js`, lines 137-138 **Vulnerability Type**: Shell command injection through unsafe command generation **Risk Level**: Medium **Vulnerable Code**: ```javascript lines.push(`💡 Read with:`); lines.push(` cat ${best.path}`); ``` ### Technical Analysis The application interpolates `best.path` directly into a suggested shell command without quoting, escaping, or using the `--` option delimiter. This path originates from Markdown filenames discovered recursively during indexing and stored in the SQLite database. Although the application does not execute the generated command itself, its documented workflow directs an AI agent or user to execute the returned `cat` command. A filename containing shell metacharacters such as command substitution, semicolons, redirection operators, or spaces can alter the command's meaning when the suggestion is copied into a shell. Exploitation requires an attacker to control a Markdown filename in the indexed documentation tree or tamper with the local index. For example, a path containing shell command-substitution syntax could cause the shell to execute the embedded command when the generated output is followed. ### Attack Path 1. An attacker gains the ability to add or rename a Markdown file under the configured documentation directory, which defaults to `/usr/lib/node_modules/openclaw/docs`. 2. The attacker gives the file a name containing shell metacharacters or command-substitution syntax. 3. The victim runs `node scripts/docs-index.js rebuild`, causing the path to be stored in the documentation index. 4. A search returns the attacker-controlled file as the best result. 5. The application prints the path as an unquoted `cat` command. 6. A user or AI agent follows the documented workflow and executes the generated command in a shell. 7. The injected shell syntax runs with the privileges of that user or agent process. ### Impac ...[truncated 612 chars]
Remediation
## Remediation Suggestions - Do not format search results as executable shell commands. Return the path as plain data and instruct callers to use a trusted filesystem-reading API or tool. - If a shell command must be displayed, apply robust POSIX shell quoting to the complete path and use an option delimiter: ```text cat -- 'properly escaped path' ``` - Never implement escaping by only replacing spaces; correctly escape embedded single quotes and all other shell-significant characters. - Consider validating indexed paths with `fs.realpathSync()` and confirming that they remain inside the configured documentation root. - Treat index contents as untrusted when loading paths from SQLite, since a local attacker could tamper with the index independently of the source documents.

T08 · Insecure Dependencies

Note
Location
package.json:17
Finding
Non-Reproducible Installation of a Mutable Native Dependency## Vulnerability Details **File Location**: `package.json`, lines 17-19 **Vulnerability Type**: Unpinned dependency and missing dependency lockfile **Risk Level**: Low **Vulnerable Code**: ```json "dependencies": { "better-sqlite3": "^11.0.0" } ``` The repository also instructs users to perform an unconstrained installation: ```bash npm install ``` ### Technical Analysis The dependency uses a caret version range, allowing npm to resolve later compatible releases instead of the exact release reviewed during this audit. No package lockfile is present in the audited project, so transitive dependency versions and package integrity values are not fixed. `better-sqlite3` is a native Node.js dependency whose installation may involve package lifecycle or native build behavior. The audited source does not show that this package is malicious; the weakness is that future installations are not reproducible and can execute dependency code that was not part of the reviewed artifact. ### Attack Path 1. A later permitted release of `better-sqlite3`, one of its resolved installation components, or the relevant package-distribution infrastructure is compromised. 2. A user follows the documented setup procedure and runs `npm install`. 3. npm resolves the mutable dependency range without a repository lockfile constraining the reviewed artifact and integrity hash. 4. The compromised package content is downloaded. 5. Any applicable package lifecycle or native installation code executes with the privileges of the user performing installation. 6. The malicious dependency can access or modify resources available to that account. ### Impact Assessment A compromised dependency could execute arbitrary code as the installing user. Depending on that account's permissions, this could expose local OpenClaw configuration, environment variables, credentials readable by the user, workspace files, or other user data. It could also modif ...[truncated 258 chars]
Remediation
## Remediation Suggestions - Generate, review, and commit a `package-lock.json` containing exact dependency versions and integrity hashes. - Use `npm ci` for installation so that dependency resolution must match the committed lockfile. - Pin the direct dependency to a reviewed exact version rather than a caret range where operationally practical. - Enable automated dependency vulnerability and provenance monitoring. - Review package lifecycle scripts and native build behavior before dependency updates. - In controlled environments, install dependencies with restricted privileges and consider initially disabling lifecycle scripts where compatible with the native module's installation requirements.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (19)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is advertised as validating specific OpenClaw configuration areas, but the reported behavior only checks documentation index resources and returns docs-related status/results. In context, that makes the mismatch more dangerous because the 'MANDATORY before changes' framing encourages overreliance during sensitive configuration work.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is advertised as validating specific OpenClaw configuration areas, but the reported behavior only checks documentation index resources and returns docs-related status/results. In context, that makes the mismatch more dangerous because the 'MANDATORY before changes' framing encourages overreliance during sensitive configuration work.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is advertised as validating specific OpenClaw configuration areas, but the reported behavior only checks documentation index resources and returns docs-related status/results. In context, that makes the mismatch more dangerous because the 'MANDATORY before changes' framing encourages overreliance during sensitive configuration work.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is advertised as validating specific OpenClaw configuration areas, but the reported behavior only checks documentation index resources and returns docs-related status/results. In context, that makes the mismatch more dangerous because the 'MANDATORY before changes' framing encourages overreliance during sensitive configuration work.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is advertised as validating specific OpenClaw configuration areas, but the reported behavior only checks documentation index resources and returns docs-related status/results. In context, that makes the mismatch more dangerous because the 'MANDATORY before changes' framing encourages overreliance during sensitive configuration work.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is advertised as validating specific OpenClaw configuration areas, but the reported behavior only checks documentation index resources and returns docs-related status/results. In context, that makes the mismatch more dangerous because the 'MANDATORY before changes' framing encourages overreliance during sensitive configuration work.

Exfiltration Commands

High
Category
Prompt Injection
Content
openclaw gateway config.get | jq '.channels'

# Test message
# Send message to channel - should see response if bound
```

---
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The example trigger phrase "how do I configure" is overly generic and can match many unrelated user requests, causing this skill to activate outside its intended OpenClaw-specific context. Because the skill is marked mandatory before openclaw.json changes and encourages inserting these triggers into agent configuration, an overbroad trigger can hijack normal conversations, alter tool-selection behavior, and increase the chance the agent follows inappropriate local instructions for unrelated tasks.

Lp3

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding
The skill declares executable behavior requiring Node and a post-install script, and the documented usage references environment-dependent paths and runtime state, but it does not declare an explicit tool scope such as allowed-tools or permissions. That creates ambiguity about what the skill may access at runtime and weakens least-privilege controls, especially for a skill that reads from home-directory and system documentation paths and writes an SQLite index under ~/.openclaw.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The comment and conditional explicitly skip the 'zh-CN' directory while indexing markdown files. This is a natural-language locale policy decision embedded in code and does not offer a user-configurable language choice or documented justification in the file.

Description-Behavior Mismatch

Medium
Confidence
89% confidence
Finding
The manifest frames the skill as a mandatory documentation-search aid for safe OpenClaw configuration work and troubleshooting. This code instead implements offline indexing behavior, including creating directories, deleting any existing index file, and constructing a new SQLite database, which is broader and materially different from simply searching docs.

Context-Inappropriate Capability

Medium
Confidence
85% confidence
Finding
The function unconditionally deletes any existing file at the supplied indexPath and then recreates it, without validating that the path points to an expected cache/index location. If an attacker or untrusted caller can influence indexPath, this enables destructive overwrite of arbitrary writable files, which is more dangerous than expected for a documentation search skill.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The guidance states that `schedule.tz` must match the user timezone and the surrounding examples consistently hard-code `Asia/Kolkata`, which effectively imposes a locale-specific default in natural-language documentation. Because the file does not offer a user choice or clearly justify the regional constraint, this conflicts with the policy against forcing a specific language/locale without opt-in.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The examples prescribe "Asia/Kolkata" as the timezone in the primary heartbeat configuration, and the same locale is repeated as the recommended setting elsewhere. This is a natural-language locale policy issue because the document presents one fixed locale as the default without offering opt-in, alternatives, or a region-specific justification.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The recovery instructions include a direct copy command that overwrites the active configuration with a backup, but they do not explicitly warn the user that this will replace current settings and may discard newer valid changes. In an agent skill context, users may follow commands verbatim, so omission of a destructive-operation warning increases the risk of accidental configuration loss and service disruption.

File System Enumeration

Medium
Category
Data Exfiltration
Content
cat ~/.openclaw/openclaw.json | jq .

# 2. If invalid JSON, restore backup
ls -la ~/.openclaw/openclaw.json.bak*
cp ~/.openclaw/openclaw.json.bak ~/.openclaw/openclaw.json

# 3. Restart
Confidence
60% confidence
Finding
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

File System Enumeration

Medium
Category
Data Exfiltration
Content
cat ~/.openclaw/openclaw.json | jq .

# 2. If invalid JSON, restore backup
ls -la ~/.openclaw/openclaw.json.bak*
cp ~/.openclaw/openclaw.json.bak ~/.openclaw/openclaw.json

# 3. Restart
Confidence
60% confidence
Finding
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This second restore workflow also presents a copy command that replaces the live configuration without a clear warning about overwrite semantics. Because the document is procedural troubleshooting guidance, users are likely to execute it during outages or stress, making accidental rollback and loss of intended configuration changes more likely.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"sqlite"
  ],
  "dependencies": {
    "better-sqlite3": "^11.0.0"
  }
}
Confidence
40% confidence
Finding
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Static analysis

No suspicious patterns detected.