Back to skill

Security audit

Inter Agent Communication

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed agent-to-agent communication helper, but it should go to Review because it creates long-lived subagent channels and includes an unsafe local command path.

Review before installing. Use this only if you intentionally want agents to create and reuse subagent communication sessions. Do not use the session-protection command as written with untrusted session keys; require explicit approval before making sessions long-lived, validate session keys, and prefer a scoped non-shell API with a clear undo path.

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
scripts/communicator.js:89
Finding
OS Command Injection Through Unsanitized Session Key<![CDATA[ ## Vulnerability Details **File Location**: `scripts/communicator.js:89-93` **Vulnerability Type**: OS command injection **Risk Level**: High ### Vulnerable Code ```javascript async function protectSession(sessionKey) { const result = await exec({ command: `openclaw sessions cleanup --active-key "${sessionKey}" --enforce` }); return result; } ``` The same unsafe command construction is recommended in `SKILL.md:151-153` and `SKILL.md:176-179`. ### Technical Analysis The `protectSession` function directly interpolates the caller-supplied `sessionKey` into a command string passed to `exec`. No validation, escaping, or argument separation is applied. Wrapping the value in double quotes does not make shell interpolation safe. An attacker-controlled value can terminate the quoted argument and introduce shell metacharacters or additional commands. Depending on the shell used by the OpenClaw `exec` tool, command substitution syntax may also be evaluated inside double quotes. The flaw becomes exploitable whenever an untrusted or insufficiently validated value can reach `protectSession`. The function is exported by the module, so any consumer of this helper can invoke it directly. ### Attack Path 1. An attacker obtains influence over a value passed as `sessionKey`, such as through an upstream message, tool result, integration, or direct invocation of the exported function. 2. The attacker supplies a session-key value containing quote-breaking syntax and a shell command, conceptually: ```text valid-prefix"; attacker-command; # ``` 3. `protectSession` embeds that value into the command: ```text openclaw sessions cleanup --active-key "valid-prefix"; attacker-command; #" --enforce ``` 4. The `exec` tool passes the constructed string to a shell. 5. The shell executes the injected command with the privileges of the OpenClaw process. This attack path requires attacker influence over the `sessionKey` argument. The reviewed func ...[truncated 929 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Do not construct shell command strings from dynamic input.** Invoke the executable through a process API that accepts an argument array and explicitly disables shell interpretation: ```javascript const { spawn } = require('node:child_process'); async function protectSession(sessionKey) { validateSessionKey(sessionKey); return new Promise((resolve, reject) => { const child = spawn( 'openclaw', ['sessions', 'cleanup', '--active-key', sessionKey, '--enforce'], { shell: false } ); let stdout = ''; let stderr = ''; child.stdout.on('data', data => { stdout += data; }); child.stderr.on('data', data => { stderr += data; }); child.on('error', reject); child.on('close', code => { if (code === 0) { resolve({ stdout, stderr, code }); } else { reject(new Error(`openclaw exited with code ${code}: ${stderr}`)); } }); }); } ``` 2. **Validate the session key before execution.** Enforce the documented subagent-session structure and a conservative character allowlist. Reject unexpected whitespace, quotes, shell metacharacters, control characters, and excessive lengths. Validation should reflect the authoritative OpenClaw session-key specification rather than accepting arbitrary strings. 3. **Verify provenance.** Where possible, accept only session keys returned directly by trusted `sessions_list` or `sessions_spawn` operations. Do not use values copied from untrusted messages or external input without independent verification. 4. **Apply least privilege.** Run the OpenClaw process under a dedicated, restricted operating-system account with minimal filesystem and credential access. Do not grant unnecessary administrative privileges. 5. **Correct the documentation.** Replace the unsafe `exec` examples in `SKILL.md:151-153` and `SKILL.md: ...[truncated 331 chars]
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (9)

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
## ❌ Wrong Examples

```javascript
// Wrong 1: Create without checking
sessions_spawn({...})  // Must check first!

// Wrong 2: Use human conversation session
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The workflow extends beyond cross-session communication into local session-lifecycle modification and anti-cleanup persistence, which is not reflected in the skill metadata. This hidden scope expansion makes the skill more dangerous because users or orchestrators may invoke it expecting only messaging behavior while it also changes environment state.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill instructs execution of a system-impacting command to disable or alter cleanup behavior without a clear user-facing warning, approval step, or discussion of persistence consequences. That can lead to unintended long-lived channels, resource retention, and covert communication paths that survive expected cleanup controls.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill adds an `exec` step that runs a shell command (`openclaw sessions cleanup ... --enforce`) even though the skill is described as a communication helper. This broadens capability from message routing into host-level command execution and session policy manipulation, creating command-injection and unauthorized persistence risk if parameters are influenced or copied into other contexts.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
`sendToAgent()` transmits messages to another agent session without any user-facing disclosure, consent, or policy check. In a multi-agent environment this can silently move prompts, secrets, or task data across sessions, which is especially risky because the helper also auto-discovers or creates persistent subagent channels.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
The module exposes shell-command execution through `exec()` to run `openclaw sessions cleanup`, which is broader and riskier than necessary for basic agent-to-agent communication. Even though the current command is hardcoded, it still introduces a command-execution primitive into a communication helper and interpolates `sessionKey` into the shell command, increasing the attack surface if untrusted values reach this function.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The cleanup function launches a subprocess that affects session-retention behavior without any user-facing warning or approval. This can alter persistence and cleanup semantics of agent sessions behind the scenes, making activity less transparent and potentially preserving channels longer than a user expects.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
The description includes both English and Chinese text, but the file does not state whether multilingual output is intentional, user-selectable, or required for a specific audience. This can violate language/locale policy when language behavior is imposed without explicit opt-in or justification.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
The module description and usage documentation are written entirely in Chinese, with no indication that language choice is optional or configurable. This can violate language/locale policy where skills should not force a specific language without user opt-in or documented justification.

Static analysis

No suspicious patterns detected.