Back to skill

Security audit

Agent Config Sync

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent multi-agent sync purpose, but it installs persistent cross-workspace behavior with weak safety controls and exploitable shell/path handling.

Install only after reviewing and preferably fixing the shell eval usage, canonical path validation, confirmation flow, and manifest authentication. Do not use this to sync API keys or sensitive agent prompt/config files unless you have a separate approval, signing, backup, and rollback process.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • 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
scripts/init_sync.sh:449
Finding
Arbitrary Shell Command Injection Through eval-Based Command Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/init_sync.sh:449-461` **Vulnerability Type**: Shell command injection **Risk Level**: Critical ### Vulnerable Code ```bash # Dry-run helper do_cmd() { if [ "$DRY_RUN" = true ]; then echo " [DRY-RUN] $*" else eval "$@" fi } # Initialize version files MEMORY_DIR="$MASTER_WS/memory" msg creating_dirs do_cmd "mkdir -p \"$MEMORY_DIR\"" ``` Additional attacker-influenced commands are evaluated at: ```bash do_cmd "echo \"\$SYNC_TEMPLATE\" > \"$agent_ws/SYNC.md\"" do_cmd "mkdir -p \"$local_agent_memory\"" do_cmd "_atomic_write \"$local_agent_memory/.agent_sync_version\" '$START_VERSION'" do_cmd "mkdir -p \"$local_agent_memory/.sync_snapshots\"" ``` ### Technical Analysis The `do_cmd` helper constructs shell commands as strings and executes them through `eval`. `eval` reparses its arguments as shell syntax, so quoting performed while creating the string does not provide a reliable security boundary. `MASTER_WS` may come directly from a positional command-line argument: ```bash elif [ -z "$MASTER_WS" ] && [ "${arg#--}" = "$arg" ]; then MASTER_WS="$arg" fi ``` It may also be derived from the editable Agent registry. No character validation, canonical path validation, or shell metacharacter rejection is performed before the value is interpolated into a command passed to `eval`. A value containing a quotation mark followed by shell syntax can terminate the intended quoted argument. Command separators, command substitutions, redirections, or pipelines can then be interpreted by the second shell parsing pass. The same unsafe execution pattern is used for writes and directory creation in downstream Agent workspaces. ### Attack Path 1. An attacker modifies `references/agent-registry.json`, influences a registry-generation source, or convinces a user to supply a crafted master-workspace argument. 2. The crafted path contains shell syntax that escapes the quoted argument used in a `do_c ...[truncated 1150 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `eval` completely. 2. Replace string-based execution with direct function calls and commands whose arguments remain distinct shell words: ```bash run_or_preview() { if [ "$DRY_RUN" = true ]; then printf ' [DRY-RUN]' printf ' %q' "$@" printf '\n' else "$@" fi } run_or_preview mkdir -p -- "$MEMORY_DIR" run_or_preview _atomic_write \ "$local_agent_memory/.agent_sync_version" \ "$START_VERSION" ``` 3. Handle multiline file creation through dedicated functions rather than constructing redirection expressions: ```bash write_file() { local destination="$1" local content="$2" if [ "$DRY_RUN" = true ]; then printf '[DRY-RUN] Would write %s\n' "$destination" else printf '%s\n' "$content" > "$destination" fi } ``` 4. Reject control characters and unexpected shell metacharacters in identifiers and paths even after removing `eval`. 5. Validate all paths canonically before performing a write. 6. Add regression tests with spaces, quotes, semicolons, command substitutions, newlines, and redirection characters in all registry and command-line inputs. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/init_sync.sh:710
Finding
Workspace Boundary Bypass Through Lexical Path Checks and Symlinks<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/init_sync.sh:710-718` - `scripts/force_sync.sh:193-201` - `scripts/revert_sync.sh:455-463` - `scripts/revert_sync.sh:568-573` **Vulnerability Type**: Path traversal and symlink-based access-control bypass **Risk Level**: High ### Vulnerable Code From `scripts/init_sync.sh`: ```bash # Path safety check — only allow ~/.openclaw/workspace-* paths case "$agent_ws" in $HOME/.openclaw/workspace-*) # allowed ;; *) continue ;; esac if [ ! -d "$agent_ws" ]; then msg agent_skip "$agent_ws" continue fi ``` From `scripts/force_sync.sh`: ```bash # Path safety check — only allow ~/.openclaw/workspace-*/memory paths case "$MEMORY_DIR" in $HOME/.openclaw/workspace-*/memory) # allowed ;; *) exit 1 ;; esac ``` From `scripts/revert_sync.sh`: ```bash # Path safety check case "$agent_ws" in $HOME/.openclaw/workspace-*) ;; *) continue ;; esac if [ ! -d "$agent_ws" ]; then msg ex_agent_skip "$agent_id" continue fi ``` The accepted paths are subsequently used for operations such as: ```bash echo "$line" >> "$agent_ws/BOOTSTRAP.md" echo "$line" >> "$agent_ws/HEARTBEAT.md" _atomic_write "$agent_revert_file" "$(cat "$REVERT_MANIFEST_FILE")" _atomic_write "$MEMORY_DIR/.current_system_version" "$TARGET_VER" ``` ### Technical Analysis The scripts validate only the textual form of a supplied path. A shell `case` pattern does not establish where the path resolves in the filesystem. Two principal bypasses are possible: 1. **Traversal components**: A path can begin with the permitted prefix while containing `..` components that resolve outside the intended workspace. 2. **Symbolic links**: A directory whose name matches `workspace-*` can be a symbolic link to a directory outside `~/.openclaw`. The subsequent `-d` check follows symbolic links and therefore does not mitigate the issue. No `realpath`, `readlink -f`, direct-child validation, or symlink rejection is perform ...[truncated 1742 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Canonicalize both the configured root and every destination before use: ```bash workspace_root="$(realpath -e -- "$HOME/.openclaw")" resolved_workspace="$(realpath -e -- "$agent_ws")" ``` 2. Require the resolved path to be an immediate workspace child of the canonical root: ```bash case "$resolved_workspace" in "$workspace_root"/workspace-*) ;; *) return 1 ;; esac [ "$(dirname -- "$resolved_workspace")" = "$workspace_root" ] || return 1 ``` 3. Explicitly reject input containing `..`, newlines, NUL-equivalent invalid data, or unexpected path components. 4. Reject symbolic-link workspaces unless symlink use is an explicitly supported and separately secured feature: ```bash [ ! -L "$agent_ws" ] || return 1 ``` 5. Validate the canonical parent directory immediately before each file creation. 6. Use symlink-resistant file operations where available, such as descriptor-based access with `O_NOFOLLOW`. 7. Revalidate after directory creation to reduce time-of-check/time-of-use race exposure. 8. Apply the same centralized validation function consistently in all four scripts. ]]>

T01 · Skill Instruction Hijacking

Error
Location
scripts/init_sync.sh:647
Finding
Unsigned Markdown Manifests Form a Persistent Agent Instruction-Injection Channel<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/init_sync.sh:647-665` - `scripts/init_sync.sh:742-765` - `scripts/wizard.sh:792-816` - `references/pending-sync-template.md:54-77` **Vulnerability Type**: Persistent Agent instruction injection and unauthenticated manifest processing **Risk Level**: Critical ### Vulnerable Code The initialization script installs persistent instructions into Agent startup and heartbeat files: ```bash BOOTSTRAP_LINES=( "" "## Startup Check — Config Sync" "- [ ] Check for \`pending_sync_*.md\` files in workspace" " - Files exist → read change summary, update MEMORY.md, delete files" ) HEARTBEAT_LINES=( "" "<!-- agent-config-sync-check v1.4 -->" "## ⭐ Config Sync Check (run every heartbeat)" "- [ ] Check for \`pending_sync_*.md\` files in workspace" " - Found and non-empty → read change summary, update MEMORY.md, delete files" " - Not found → skip" " - Verify SHA256 signature integrity" " - Check \`memory/.agent_sync_version\` — if < system version, request catch-up from Master" ) ``` These instructions are appended persistently: ```bash for line in "${BOOTSTRAP_LINES[@]}"; do echo "$line" >> "$agent_ws/BOOTSTRAP.md" done for line in "${HEARTBEAT_LINES[@]}"; do echo "$line" >> "$agent_ws/HEARTBEAT.md" done ``` The documented signature is an unkeyed truncated hash: ```python import hashlib def verify_sync_file(filename, expected_version, change_summary): expected_sig = hashlib.sha256( f"pending_sync_{expected_version}_{change_summary}".encode() ).hexdigest()[:12] actual_sig = filename.split("_")[-1].replace(".md", "") return expected_sig == actual_sig ``` ### Technical Analysis The Skill changes long-lived Agent instruction files so that future startup and heartbeat cycles automatically discover and process Markdown files with a matching name. The pending files contain natural-language change descriptions and operational instructions. The project ex ...[truncated 2647 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace unkeyed hashes with authenticated digital signatures: - Keep a protected signing key available only to the trusted Master. - Pin the corresponding public verification key in each Agent. - Sign the complete canonical manifest, including version, expiry, target Agent, operation list, and content digest. - Reject unknown signers and invalid or missing signatures. 2. Replace natural-language operational instructions with a strict declarative schema, for example: ```json { "version": "v3.2", "target_agent": "acode", "expires_at": "2026-05-17T08:30:00Z", "operations": [ { "type": "replace_config_value", "file": "TOOLS.md", "approved_digest": "..." } ] } ``` 3. Allowlist supported operations and destination files. 4. Prohibit automatic changes to prompt files, credentials, plugins, executables, cron jobs, startup files, and security policy. 5. Require explicit user approval for all high-impact changes. 6. Bind each signed manifest to a specific target Agent and deployment identifier to prevent replay across workspaces. 7. Include a monotonic sequence number or nonce and persist an authenticated replay-prevention record. 8. Parse manifests as data only; never treat free-form Markdown as trusted Agent instructions. 9. Quarantine invalid manifests rather than deleting them, and record an auditable security event. 10. Run receiving Agents with minimum filesystem and tool privileges. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/init_sync.sh:437
Finding
Automatic Setup Bypasses the Documented Confirmation and Preview Requirement<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/init_sync.sh:437-445` - `scripts/wizard.sh:732-742` - `SECURITY.md:53-66` **Vulnerability Type**: Consent-control bypass for persistent cross-workspace modifications **Risk Level**: Medium ### Vulnerable Code The confirmation check explicitly excludes automatic mode: ```bash # Confirm check required for non-dry-run, non-auto execution if [ "$DRY_RUN" = false ] && [ "$AUTO_MODE" = false ] && [ "$CONFIRMED" = false ]; then exit 0 fi ``` The wizard invokes initialization with `--confirm` without enforcing a preceding dry run: ```bash local exit_code=0 if [ "$DRY_RUN_STEP3" = true ]; then bash "$INIT_SCRIPT" --confirm --lang "$LANG" --dry-run 2>&1 || exit_code=$? else bash "$INIT_SCRIPT" --confirm --lang "$LANG" 2>&1 || exit_code=$? fi ``` This conflicts with the documented security model, which states that write operations require a dry-run preview followed by an explicit `--confirm` execution. ### Technical Analysis The setup process performs broad, persistent modifications: - It writes the Agent registry. - It creates version and journal state. - It creates or overwrites `SYNC.md`. - It appends instructions to `BOOTSTRAP.md`. - It appends recurring instructions to `HEARTBEAT.md`. - It creates memory and rollback-snapshot directories across Agent workspaces. Despite this scope, `init_sync.sh --auto` does not require `--confirm`. Separately, the wizard supplies `--confirm` programmatically even if the user did not first review a dry-run plan. A command-line flag only demonstrates informed consent when the user deliberately supplies it after receiving an accurate description of the pending changes. Automatically adding the flag from another script defeats that control. The problem is compounded by the fact that existing `SYNC.md` content may be overwritten without the backup described by the security documentation. ### Attack Path 1. A user follows the recommended one-command auto ...[truncated 977 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require `--confirm` for every non-demo write operation, including `--auto`. 2. Do not allow the wizard to silently supply confirmation on the user’s behalf. 3. Generate an exact change plan listing: - Every destination file. - Whether it will be created, overwritten, or appended. - A concise diff for existing files. - The canonical resolved path. 4. Require a separate explicit confirmation after displaying the plan. 5. Provide a noninteractive mechanism using a plan digest: ```text init_sync.sh --plan > plan.txt init_sync.sh --apply-plan <approved-plan-digest> ``` 6. Back up every existing file before modifying it, including `SYNC.md`, `BOOTSTRAP.md`, and `HEARTBEAT.md`. 7. Make writes transactional so a failure restores all files changed during that setup attempt. 8. Clearly distinguish harmless workspace discovery from state-changing automatic configuration. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
Findings (67)

Credential Access

High
Category
Privilege Escalation
Content
```
✅ ~/.openclaw/workspace-acode/BOOTSTRAP.md    → allowed
❌ /etc/passwd                                   → rejected
❌ ~/.openclaw/openclaw.json                     → rejected (not in a workspace)
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
```
✅ ~/.openclaw/workspace-acode/BOOTSTRAP.md    → allowed
❌ /etc/passwd                                   → rejected
❌ ~/.openclaw/openclaw.json                     → rejected (not in a workspace)
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared description presents a multi-agent configuration synchronization mechanism that tracks master changes and propagates updates to agents, with agents checking for updates on BOOTSTRAP/HEARTBEAT. The supplied code is instead a dedicated rollback utility: it requires a target version, ensures the target is a published older version, checks for snapshots, generates a revert manifest, writes that manifest into each agent workspace, updates the current version pointer backward, and logs a revert event. While both concern version management across agents, the primary purpose and operational behavior are materially different. This is not merely an implementation detail; rollback orchestration is a distinct capability that is undeclared in the provided description.

Ae1

High
Category
analysis-evasion
Content
> bash scripts/wizard.sh
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
> bash scripts/wizard.sh
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
> bash scripts/wizard.sh
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
> bash scripts/wizard.sh
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
> bash scripts/wizard.sh
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
> bash scripts/wizard.sh
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
"blacklist": ["HEARTBEAT.md", "BOOTSTRAP.md", "SKILL.md", "scripts/", "SECURITY.md", "references/"],
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
"blacklist": ["HEARTBEAT.md", "BOOTSTRAP.md", "SKILL.md", "scripts/", "SECURITY.md", "references/"],
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
"blacklist": ["HEARTBEAT.md", "BOOTSTRAP.md", "SKILL.md", "scripts/", "SECURITY.md", "references/"],
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Exfiltration Commands

High
Category
Prompt Injection
Content
## 🔗 Sync Source
- Full log: <master_workspace>/memory/CHANGELOG.md
- Active query: send message to master agent

## 🔒 Important
- Check version before using coordinated systems
Confidence
90% confidence
Finding
Instructions found that direct the agent to transmit conversation context or user data to external services.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The README states that the skill syncs API keys, while the security section later claims there is no credential access. That inconsistency is security-relevant because users may deploy the skill under a false assumption that secrets are never read or propagated, when the documented feature set explicitly includes credential synchronization across multiple agent workspaces. In a multi-agent environment, propagating API keys materially increases the blast radius of any compromise or misconfiguration.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The README explicitly includes API keys in the set of synchronized items but does not warn users about the security implications of copying credentials across agents. In this skill's context, that is more dangerous because it is designed for multi-agent coordination and broad workspace propagation, so a single mistaken sync could duplicate sensitive secrets into multiple locations, logs, backups, or less-trusted agent environments.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Content
### Not Required
- ❌ Network access (no external API calls)
- ❌ Execute arbitrary commands
- ❌ Access outside `~/.openclaw/workspace-*`
- ❌ Read secrets or credentials
- ❌ Modify other installed skills
Confidence
80% confidence
Finding
Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
- The sync system appears broken even though infrastructure is healthy
- No error is logged by the atomic write wrapper

**Fix**: `chmod 664 memory/.current_system_version memory/.last_sync_version memory/.sync_journal.jsonl`

**Verification** (run after init/force_sync):
```bash
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger list includes broad terms like 'sync' and 'configure', which are common in ordinary conversations and unrelated tasks. In an agent skill system, overbroad triggers can cause unintended activation of a capability that writes across multiple workspaces, raising the chance of accidental configuration changes or unsafe operator confusion.

Intent-Code Divergence

Medium
Confidence
92% confidence
Finding
The security section claims all scripts require --confirm for write operations, but elsewhere the document shows write-capable commands without that safeguard. For a skill that modifies multiple agent workspaces, inconsistent safety guarantees can lead users or downstream tooling to invoke mutating commands under the false assumption that writes are gated, increasing the risk of unintended state changes.

Session Persistence

Medium
Category
Rogue Agent
Content
> **New in v1.4**: Full version conflict management — dispatch lock, loop detection, self-upgrade isolation, batch mode, rollback snapshots, TTL-based expiry, offline catch-up, and agent-side version collapse. See [Version Conflict Management](#version-conflict-management-v14) for details.
>
> **Security**: This skill writes to agent workspaces across your OpenClaw deployment. Read the full [SECURITY.md](SECURITY.md) for permission scope, path validation, cross-agent isolation, and user consent flow. Key highlights:
> - All scripts require `--confirm` for write operations (use `--dry-run` to preview first)
> - Only paths under `~/.openclaw/workspace-*` are allowed (path validation enforced)
> - Each agent can only read/write its own workspace files
> - No network access, no external API calls, no credential access
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.

Session Persistence

Medium
Category
Rogue Agent
Content
# Preview what will be created (safe, no changes required)
bash scripts/init_sync.sh --dry-run

# Run the real setup (--confirm required for write operations)
bash scripts/init_sync.sh --confirm
```
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.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The file specifies that scripts default to Chinese output and require users to pass `--lang en` for English. This imposes a language default rather than offering a neutral prompt or explicit opt-in, which can violate language/locale policy expectations.

Session Persistence

Medium
Category
Rogue Agent
Content
# Preview the version change
bash scripts/force_sync.sh --dry-run ~/.openclaw/workspace-<master>/memory v3.0 v3.1

# Execute (--confirm required for write operations)
bash scripts/force_sync.sh --confirm ~/.openclaw/workspace-<master>/memory v3.0 v3.1
```
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.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Dispatched but not processed | Agent missing BOOTSTRAP sync check | Re-run `init_sync.sh` for that agent's workspace |
| `pending_sync` files piling up | Agent never deletes after processing | Check agent's HEARTBEAT.md has sync check with delete step |
| Same version synced repeatedly | `.last_sync_version` not updated | Run `force_sync.sh` to reset, or check journal for stale records |
| Version sentinel files (`.current_system_version`, `.last_sync_version`) are read-only | Accidental `chmod 444` or permission inheritance | **All writes silently fail** — version appears unchanged. Fix: `chmod 664 memory/.current_system_version memory/.last_sync_version` |
| Dispatched but log says "permission denied" | Sentinel files or journal files have wrong ownership | `ls -la memory/.current_system_version memory/.last_sync_version memory/.sync_journal.jsonl` → verify writable by the user running OpenClaw |

### Version Conflicts
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Dispatched but not processed | Agent missing BOOTSTRAP sync check | Re-run `init_sync.sh` for that agent's workspace |
| `pending_sync` files piling up | Agent never deletes after processing | Check agent's HEARTBEAT.md has sync check with delete step |
| Same version synced repeatedly | `.last_sync_version` not updated | Run `force_sync.sh` to reset, or check journal for stale records |
| Version sentinel files (`.current_system_version`, `.last_sync_version`) are read-only | Accidental `chmod 444` or permission inheritance | **All writes silently fail** — version appears unchanged. Fix: `chmod 664 memory/.current_system_version memory/.last_sync_version` |
| Dispatched but log says "permission denied" | Sentinel files or journal files have wrong ownership | `ls -la memory/.current_system_version memory/.last_sync_version memory/.sync_journal.jsonl` → verify writable by the user running OpenClaw |

### Version Conflicts
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Static analysis

No suspicious patterns detected.