Back to skill

Security audit

Create Agent

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly an agent-creation helper, but it includes unsafe token-copying guidance and broad local write behavior that users should review before installing.

Install only if you understand that this skill will persistently change your OpenClaw agent files, workspace files, openclaw.json, and TEAM.md. Prefer dry-run first, avoid running it as root, use only trusted workspace paths, and do not follow the browser-token extraction guide; use an official scoped token or supported login flow and keep secrets out of shell history and source control.

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

Warning
Location
scripts/create_agent.py:550
Finding
Unvalidated Agent and Workspace Paths Allow Arbitrary File Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `scripts/create_agent.py:550-556, 592-604, 613-622` **Vulnerability Type**: Path traversal and arbitrary destination write **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument('--id', help='Agent ID(如 dev-fe)') parser.add_argument('--name', help='Agent 名称(如 前端工程师)') parser.add_argument('--role', default='custom', help='预设角色模板') parser.add_argument('--model', default=None, help='使用的模型') parser.add_argument('--channel', default='telegram', help='通信渠道') parser.add_argument('--emoji', default=None, help='Agent emoji') parser.add_argument('--workspace', default=None, help='工作区路径') ``` ```python workspace = args.workspace or f"/root/.openclaw/workspace-{args.id}" agent_dir = Path(f'/root/.openclaw/agents/{args.id}/agent') workspace_dir = Path(workspace) if not args.dry_run: agent_dir.mkdir(parents=True, exist_ok=True) workspace_dir.mkdir(parents=True, exist_ok=True) ``` ```python create_identity_file(args.id, args.name, args.role, emoji, report_to, agent_dir / 'IDENTITY.md', args.dry_run) create_soul_file(args.role, agent_dir / 'SOUL.md', args.dry_run) create_agents_file(args.id, agent_dir / 'AGENTS.md', args.dry_run) create_user_file(agent_dir / 'USER.md', args.dry_run) # Synchronize into the workspace if not args.dry_run: import shutil for f in ['IDENTITY.md', 'SOUL.md', 'AGENTS.md', 'USER.md']: shutil.copy(agent_dir / f, workspace_dir / f) ``` The destination files are opened in write mode by the generation functions, for example: ```python with open(output_path, 'w', encoding='utf-8') as f: f.write(template) ``` ### Technical Analysis The documentation specifies that an agent ID should contain lowercase letters, numbers, and hyphens, but the implementation does not enforce this restriction. The `--id` value is interpolated directly into an absolute filesystem path, allowing path components such as `..`. More directly, `--workspace` accepts an arbitra ...[truncated 2200 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Strictly validate agent IDs before performing any filesystem operation: ```python import re if not re.fullmatch(r'[a-z0-9]+(?:-[a-z0-9]+)*', args.id or ''): raise ValueError("Agent ID must contain only lowercase letters, digits, and hyphens") ``` 2. Canonicalize and constrain generated paths to approved roots: ```python agent_root = Path.home() / ".openclaw" / "agents" agent_dir = (agent_root / args.id / "agent").resolve() if agent_root.resolve() not in agent_dir.parents: raise ValueError("Agent path escapes the approved agent root") ``` 3. Restrict workspaces to a configured workspace root unless an explicit administrative override is used. Resolve the requested path and verify containment before creating it. 4. Reject symbolic links in destination path components and before each write. Where practical, use descriptor-based operations with no-follow semantics to reduce time-of-check/time-of-use risks. 5. Do not silently overwrite existing files. Use exclusive creation, create a backup, or require explicit `--force` confirmation. 6. Run the Skill as an unprivileged OpenClaw service account rather than root. 7. Validate all arguments before creating any directory or changing `openclaw.json`, so invalid input cannot leave a partially modified installation. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
GET_TOKEN.md:88
Finding
Authentication Token Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `GET_TOKEN.md:88` **Vulnerability Type**: Insecure handling of authentication credentials **Risk Level**: Low ### Vulnerable Code ```bash clawhub login --token <粘贴-Token> --label "server-cli" ``` ### Technical Analysis The guide recommends placing a ClawHub authentication token directly in a command-line argument. The same guide identifies this token as password-equivalent. Command-line secrets can be recorded in shell history, terminal logs, audit records, process accounting, or automation logs. Depending on operating-system process visibility and user isolation, another local user may also be able to inspect the argument while the command is running. Although the CLI may legitimately support `--token`, documenting direct token substitution encourages credential handling that leaves avoidable plaintext traces. ### Attack Path 1. A user follows the documented login command and substitutes a real token for the placeholder. 2. The shell records the full command in history, or another logging or process-monitoring facility captures its arguments. 3. A local attacker, support operator, backup reader, or log reader obtains access to that record. 4. The attacker extracts the ClawHub token. 5. The attacker uses the token until it expires or is revoked. ### Impact Assessment A recovered token may permit actions available to the associated ClawHub account, potentially including authentication, publication of Skills, or modification of published content. The exact scope depends on the permissions assigned to the token. Exploitation generally requires local access, access to shell or audit logs, or another ability to observe command-line arguments. This limits the severity but does not eliminate the credential-exposure risk. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Prefer an interactive hidden prompt implemented by the CLI so that the token is not included in command-line arguments. 2. If supported, pass the token through standard input: ```bash printf '%s' "$CLAWHUB_TOKEN" | clawhub login --token-stdin --label "server-cli" ``` 3. Alternatively, use a credential file with restrictive permissions: ```bash chmod 600 ~/.config/clawhub/token ``` The CLI should read the token directly from that protected file rather than requiring command substitution that exposes its contents in process arguments. 4. Avoid examples that place real secrets directly into commands. Document the security implications of shell history, CI logs, terminal recording, and process inspection. 5. Instruct users who have already supplied a token on the command line to remove affected history and logs where feasible, revoke the exposed token, and generate a replacement. 6. Ensure stored credentials are protected with least-privilege filesystem permissions and are never committed to version control. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (12)

Missing User Warnings

High
Confidence
98% confidence
Finding
The document gives step-by-step instructions for extracting live authentication tokens from browser network traffic, cookies, and local storage, then reusing them on another server. Even though it briefly says tokens are like passwords near the end, the core behavior is credential harvesting and reuse, which materially increases the risk of account compromise, session theft, and unauthorized access.

Ssd 3

High
Confidence
99% confidence
Finding
These instructions explicitly direct the user to locate and copy authentication material from browser headers, cookies, storage, or account pages and then use it on a server for CLI publishing. In a skill context, that normalizes credential exfiltration and cross-environment reuse, which can enable unauthorized publishing, account takeover, or secret leakage if followed by someone without a clear security boundary.

Natural-Language Policy Violations

Medium
Confidence
86% confidence
Finding
The document presents all instructions in Chinese with no indication that language selection is optional or context-specific. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless clearly justified.

External Transmission

Medium
Category
Data Exfiltration
Content
- 在左侧请求列表中找包含 `api` 的请求
- 常见 URL 模式:
  - `https://clawhub.ai/api/...`
  - `https://api.clawhub.ai/...`
  - `https://clawhub.biz/api/...`

**6. 查看请求头**
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The documentation explicitly advertises automatic generation of agent files and updates to shared configuration such as openclaw.json and TEAM.md, but it does not prominently warn users that running the skill will perform local writes and mutate shared state. In a setup tool, undisclosed write behavior increases the risk of accidental configuration changes, overwriting existing data, or introducing unauthorized agent/binding entries through routine use.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The README states that the skill will automatically create agent directories and modify shared configuration files such as openclaw.json and TEAM.md, but it does not warn users about overwrite risk, merge conflicts, or unintended changes to existing local state. In an agent-management context, silent modification of global config and workspace files can disrupt other agents, corrupt configuration, or cause users to lose existing settings.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The README instructs users to place bot tokens and app secrets into configuration or environment variables, but it does not include guidance on protecting those credentials from disclosure, accidental commits, or insecure storage. Because these secrets grant control over external messaging integrations, mishandling them could lead to account compromise, impersonation, or abuse of connected channels.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The natural-language content of the skill description, usage instructions, warnings, and troubleshooting is presented exclusively in Chinese. This can violate a language or locale policy when no user opt-in or explicit region-specific scope is provided.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The script writes `USER.md` with a fixed communication language of `中文`, which imposes a specific language preference on the generated agent configuration. This is a natural-language locale policy issue because the file does not offer any user choice or indicate that the language setting is optional or region-specific.

Tainted flow: 'workspace_dir' from input (line 600, user input) → shutil.copy (file write)

Medium
Category
Data Flow
Content
if not args.dry_run:
        import shutil
        for f in ['IDENTITY.md', 'SOUL.md', 'AGENTS.md', 'USER.md']:
            shutil.copy(agent_dir / f, workspace_dir / f)
        log(f"  同步到工作区", 'success')
    
    # 3. 更新 openclaw.json
Confidence
92% confidence
Finding
The script accepts a user-controlled --workspace path and later copies generated files into that location without constraining it to an approved base directory or checking for symlinks. When run with elevated privileges, an attacker or mistaken operator could overwrite files in arbitrary locations, including sensitive system or application paths, causing configuration corruption or privilege-impacting file placement.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
Natural-language policy issues include forcing a specific language without user opt-in. This file presents all operational instructions in Chinese and does not state that the skill is region-specific or provide an alternative language option.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The natural-language content of the README is exclusively Chinese, including setup and operational instructions. Under the policy rule, forcing a specific language without user opt-in or a documented justification is a locale-policy concern.

Static analysis

No suspicious patterns detected.