Back to skill

Security audit

Install Shared Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill performs a high-impact install action, but its stated install scope conflicts with its actual workspace-targeted command and its tool scripts expose unsafe shell execution.

Only install this after the publisher fixes the shell execution issue and makes the install destination unambiguous. As written, a crafted skill name could run unintended commands, and users may believe they are installing globally when the tool is actually targeting the current workspace.

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

Error
Location
tools/install_skill.js:12
Finding

OS Command Injection in install_skill

Content
View full analysis
--workdir ./ const command = `clawhub install ${skillName} --workdir ./`; // Run in current workspace exec(command, { cwd: process.env.OPENCLAW_WORKSPACE || process.cwd() }, (error, stdout, stderr) => { ``` ### Technical Analysis The `skillName` argument is attacker-controlled input obtained directly from `process.argv[2]`. The code checks only that it is non-empty and then interpolates it into a command string passed to `child_process.exec`. Because `exec` invokes the command through a system shell, shell metacharacters contained in `skillName` are interpreted rather than treated as part of a literal ClawHub skill identifier. An input containing separators, substitutions, redirections, or pipelines can therefore append or substitute arbitrary shell commands. For example, a value conceptually shaped like: ```text legitimate-skill; attacker-controlled-command ``` would cause the shell to process both the intended installation command and the injected command. The precise syntax depends on the operating system shell. ### Attack Path 1. An attacker or untrusted caller invokes `install_skill` with a crafted `skill_name`. 2. The tool reads that value from `process.argv[2]`. 3. The value is inserted without escaping or validation into: ```text clawhub install --workdir ./ ``` 4. `child_process.exec` passes the resulting string to a system shell. 5. The shell interprets attacker-provided metacharacters and executes the injected command. 6. The injected process runs with the same operating-system identity, environment, filesystem access, and network per ...[truncated 1015 chars]
Remediation
View remediation
{ if (stdout) process.stdout.write(stdout); if (stderr) process.stderr.write(stderr); process.exit(error ? 1 : 0); } ); ``` 2. Validate `skillName` against the official ClawHub identifier grammar. Prefer a strict allowlist of permitted characters and enforce reasonable length limits. For example, if compatible with the actual ClawHub specification: ```js if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(skillName)) { console.error('ERROR: invalid skill_name'); process.exit(1); } ``` 3. Do not attempt to fix this solely by manually quoting or escaping the argument. Avoiding the shell through structured argument passing is the primary control. 4. Run the installer with the minimum required filesystem and network privileges, and avoid exposing unrelated credentials in its environment. 5. Add regression tests using shell metacharacters such as semicolons, pipes, redirection operators, command substitutions, spaces, and newline characters. Tests should verify that these values are rejected or passed only as literal arguments. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
tools/install_shared_skill.js:12
Finding

OS Command Injection in install_shared_skill

Content
View full analysis
--workdir ./ const command = `clawhub install ${skillName} --workdir ./`; // Run in current workspace exec(command, { cwd: process.env.OPENCLAW_WORKSPACE || process.cwd() }, (error, stdout, stderr) => { ``` ### Technical Analysis The alias tool contains the same vulnerable command construction as `install_skill`. It accepts `skillName` from `process.argv[2]`, performs no syntactic validation, embeds the value into a shell command, and invokes that command through `child_process.exec`. The shell consequently treats command separators, substitutions, pipelines, and redirections in the supplied skill name as executable syntax. The input is therefore not constrained to selecting a ClawHub skill and can alter the command executed by the host. A malicious value conceptually shaped like: ```text legitimate-skill; attacker-controlled-command ``` can append another command. Exploitation does not require modifying the project files; it requires only the ability to invoke the exposed tool with a crafted argument. ### Attack Path 1. An attacker or untrusted caller invokes `install_shared_skill` with a malicious `skill_name`. 2. The value is read directly from the process arguments. 3. The program concatenates it into the `clawhub install` command string without validation. 4. `exec` launches a system shell to evaluate that string. 5. Shell syntax embedded in the argument changes the intended command or introduces additional commands. 6. The injected command executes under the OpenClaw process account and inherits its accessible environment and resources. ### Impact Asses ...[truncated 867 chars]
Remediation
View remediation
{ if (stdout) process.stdout.write(stdout); if (stderr) process.stderr.write(stderr); process.exit(error ? 1 : 0); } ); ``` 2. Enforce the official ClawHub skill-name syntax with a strict allowlist and a maximum length. Reject whitespace, control characters, shell metacharacters, and values not conforming to that specification. 3. Avoid relying solely on shell escaping because escaping behavior varies between shells and operating systems. Passing arguments without a shell provides a stronger boundary. 4. Consolidate both alias tools around one reviewed implementation to avoid duplicating security-sensitive process-launching code. 5. Execute the installer under least privilege and provide only the credentials, filesystem paths, and network access required for installation. 6. Add automated negative tests proving that separators, substitutions, pipes, redirections, quotes, newlines, and other malformed identifiers cannot trigger additional commands. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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 (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This is a real security-relevant mismatch: the metadata promises non-workspace, shared installation, while the actual command targets ./ via --workdir. In multi-agent or automated environments, that discrepancy can mislead callers into granting trust or invoking the skill in sensitive repositories, where it may unexpectedly alter project state instead of a separate global skill directory.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This is a real security-relevant mismatch: the metadata promises non-workspace, shared installation, while the actual command targets ./ via --workdir. In multi-agent or automated environments, that discrepancy can mislead callers into granting trust or invoking the skill in sensitive repositories, where it may unexpectedly alter project state instead of a separate global skill directory.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest advertises system/global shared installation, but the documented tool behavior installs into the current workdir. This can cause unsafe operator assumptions about where code is being fetched and written, increasing the chance of unintended modifications to an active workspace and making audits or access-control expectations inaccurate.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

install_shared_skill is presented as a shared-install alias, but the documented command remains workspace-scoped. That makes the alias especially misleading: users may invoke it specifically because they want safe separation from the current project, yet it performs the opposite and can mutate the active repository or workspace context.

Content

No source excerpt is available for this finding.

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'env' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill claims to perform shared/system-level installation, but the implementation invokes clawhub install ... --workdir ./ in the current workspace, causing installation in a workspace-scoped location instead. This mismatch is dangerous because operators and downstream agents may trust the documented scope and unintentionally install or modify content in the active workspace, enabling persistence, dependency confusion, or unauthorized workspace changes under false assumptions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill metadata promises a shared/system-level install, but the implementation forces installation into the current workspace with --workdir ./. This mismatch can cause users or downstream agents to believe a skill was installed globally when it was actually placed in a local, potentially attacker-controlled directory, enabling scope confusion and unintended trust of workspace content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file describes installing skills at the local/system level so they are shared by all agents, which can affect system integrity and other agents' behavior. Although the behavior is stated, it does not include an explicit caution or warning about the global impact of the operation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The inline comments assert an exact invocation and workspace behavior that contradict the skill's stated purpose of shared/system installation, creating deceptive operational guidance. In a security-sensitive automation context, misleading comments materially increase risk because reviewers may approve or reuse the tool based on false assumptions, overlooking that it writes into the current workspace.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The inline comments explicitly describe workspace-scoped behavior that contradicts the skill's stated shared/system-level purpose. Security-relevant documentation mismatches are dangerous because operators and agents may rely on the comments/manifest for trust decisions, leading to incorrect assumptions about install scope and where untrusted code lands.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tools/install_shared_skill.js:25

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
tools/install_skill.js:25