Back to skill

Security audit

Agent Creation

Security checks for vulnerabilities and agentic risk

Overview

The skill’s purpose is coherent, but it tells agents to create persistent OpenClaw agent state and run user-derived command values without enough validation or confirmation.

Install only if you are comfortable with a skill that can create OpenClaw agent workspaces and persistent configuration under your home directory. Before using it, require the agent to validate agent and identity names, show the exact files and commands it will use, confirm before writing or replacing SOUL.md, and avoid shell interpolation for user-provided values.

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
SKILL.md:16
Finding

Shell Command Injection Through Unsanitized Agent Identity

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 16–29
Vulnerability Type: Shell command injection
Risk Level: High

Vulnerable Code Snippet:

markdown
### Step 1: Generate Agent Information
Generate the following information based on the user's input:

| Item | Description |
|--------|------|
| **Agent Name** | Unique identifier, lowercase English, hyphen-separated |
| **Identity Name** | Friendly name visible to users |
| **SOUL.md** | Defines the agent's personality, communication style, and boundaries; affects interaction style |

### Step 2: Create Agent Using Commands

```bash
openclaw agents add <agent-name> --workspace ~/.openclaw/workspace-<agent-name>
openclaw agents set-identity --agent <agent-name> --name "<identity-name>"
text

### Technical Analysis

The skill instructs an agent to derive `identity-name` from user input and interpolate it into a shell command. Although the value is enclosed in double quotes, shell command substitutions such as `$(command)` and backtick substitutions remain active inside double-quoted strings.

The document imposes a restricted naming format on `agent-name`, but it does not define equivalent validation or shell escaping for `identity-name`. If the generated command is executed through a shell, a malicious identity such as `$(attacker-command)` can cause an additional command to run before the resulting text is passed to `openclaw`.

This vulnerability depends on the implementing agent directly substituting user-controlled content into the documented command and executing it through a shell. The package contains no executable scripts, but its operational instructions establish the unsafe execution pattern.

### Attack Path

1. An attacker requests creation of an agent and supplies an identity name containing shell syntax, such as `$(id > /tmp/openclaw-proof)`.
2. The skill treats the supplied value as the gen
...[truncated 1206 chars]
Remediation
View remediation

Remediation Suggestions

  1. Do not construct shell command strings from user-controlled values. Invoke openclaw through an API that accepts an argument array and does not launch a shell.
  2. Apply explicit allowlist validation to both fields before execution:
    • Restrict agent-name to a pattern such as ^[a-z0-9]+(?:-[a-z0-9]+)*$.
    • Define and enforce a conservative character set and maximum length for identity-name.
  3. Reject shell metacharacters and control characters, including command-substitution syntax, backticks, newlines, null bytes, and unexpected option-like values.
  4. Use an end-of-options delimiter where supported and keep every user-controlled value in a distinct process argument.
  5. If shell execution is unavoidable, use a proven shell-escaping routine appropriate to the exact shell rather than relying on double quotes.
  6. Update the skill instructions to require validation before any command is run and to request user confirmation showing the normalized agent and identity values.
  7. Execute the workflow with least privilege and restrict its filesystem, credential, and network access to reduce the impact of any command-injection failure.
  8. Add negative tests covering values such as $(id), backtick substitutions, quotes, semicolons, newlines, leading hyphens, and path traversal sequences.
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (3)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger conditions are broad enough to match ordinary conversational requests, which can cause the skill to activate without clear user intent to create or modify an agent. Because this skill performs setup actions that can create workspaces and alter configuration files, unintended invocation can lead to unauthorized or surprising state changes.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

The skill creates a new agent and assigns it a persistent workspace under the user's home directory, which establishes durable session state beyond the current interaction. Persistent state is not inherently unsafe, but here it is introduced through commands and file writes without clear safeguards, increasing the risk of unwanted long-lived agents, configuration drift, or misuse of stored memory.

Content

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

| Identity Name | Friendly name visible to users | | SOUL.md | Defines the agent's personality, communication style, and boundaries; affects interaction style |

Step 2: Create Agent Using Commands

bash
openclaw agents add <agent-name> --workspace ~/.openclaw/workspace-<agent-name>

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill instructs the agent to replace SOUL.md and create memory files in the workspace, but it does not require warning the user or obtaining confirmation before modifying persistent files. This is dangerous because the skill changes durable agent configuration and state, which could overwrite existing content or create unintended artifacts without the user's informed consent.

Content

No source excerpt is available for this finding.