Back to skill

Security audit

Expert Library Plus Skill

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real installer, but it needs Review because it persistently changes OpenClaw expert files and includes an unsafe shell-based verifier call.

Review before installing. This package does not show exfiltration, credential theft, destructive behavior, or hidden background persistence, but it does modify persistent OpenClaw expert files. Install only from a trusted location, keep backups of ~/.openclaw/experts, and prefer a fixed installer that replaces os.system with subprocess.run using an argument list and asks before overwriting user-created expert or name-library files.

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/install.py:76
Finding

Shell Command Injection Through an Unquoted Verification Path

Content
View full analysis

Vulnerability Details

File Location: scripts/install.py, lines 76–79
Vulnerability Type: OS command injection
Risk Level: High

Vulnerable Code

python
verify_path = Path(__file__).parent.parent / "verify.py"
if verify_path.exists():
    print("\n🔍 Verifying installation...")
    os.system(f"python {verify_path}")

Technical Analysis

The installer constructs a shell command by interpolating verify_path directly into a string passed to os.system. Because os.system invokes a command shell and the path is not quoted or escaped, shell metacharacters contained in the project directory path can be interpreted as command syntax rather than as part of the filename.

Although the path is derived from __file__, an attacker may control it by placing or extracting the project beneath a specially crafted directory name. Exploitation also requires a file to exist at the computed <project-root>/verify.py path. The audited package normally contains the verifier at scripts/verify.py, so this condition is not met in the package as reviewed; however, an attacker controlling the containing project tree can add the expected file and trigger the vulnerable call.

Attack Path

  1. An attacker prepares or extracts the project beneath a directory whose name contains shell metacharacters and an injected command.
  2. The attacker places a file at the computed <project-root>/verify.py location so that the verify_path.exists() condition succeeds.
  3. The attacker convinces a victim to execute scripts/install.py.
  4. After installation, the script interpolates the crafted path into python {verify_path}.
  5. os.system passes the resulting string to the platform shell.
  6. The shell parses the metacharacters and executes the attacker-supplied command with the victim's privileges.

Impact Assessment

Successful exploitation permits arbitrary command execution under the account running the insta ...[truncated 429 chars]

Remediation
View remediation

Remediation Suggestions

Avoid invoking a shell. Execute the verifier with an argument array and the current Python interpreter:

python
import subprocess

verify_path = Path(__file__).resolve().parent / "verify.py"
if verify_path.is_file():
    print("\n🔍 Verifying installation...")
    subprocess.run(
        [sys.executable, str(verify_path)],
        check=True,
    )

This approach prevents shell metacharacters in paths from being interpreted as command syntax. It also corrects the verifier location: the packaged verifier is scripts/verify.py, in the same directory as install.py, rather than at the project root.

Additional hardening should include:

  • Resolve and validate the verifier path before execution.
  • Require it to be a regular file and reject unexpected symbolic links where the trust model requires that restriction.
  • Propagate verification failures by using check=True and handling subprocess.CalledProcessError.
  • Do not attempt to fix the issue solely through manual quoting; shell-free process invocation is safer and cross-platform.
  • Add tests using project paths containing spaces and shell metacharacters.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The installer invokes a shell via os.system() to run verify.py, which is unsafe because shell-based execution can mis-handle spaces or shell metacharacters in the path and inherits ambient execution context. In an installer, this also creates an unnecessary code-execution step during setup, increasing risk if the repository or local path is tampered with.

Content

Scanner excerpt · scripts/install.py (reported line 80)May include surrounding context.

python
verify_path = Path(__file__).parent.parent / "verify.py"
    if verify_path.exists():
        print("\n🔍 Verifying installation...")
        os.system(f"python {verify_path}")
    
    print("\n🎉 Expert Library Plus is ready to use!")
    print("Try: '请专家帮我设计一个产品'")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to download, install, back up, update, and verify files across the local system, which implies shell execution, filesystem writes, and environment access, but it declares no explicit tool scope or permission boundaries. This creates a permission transparency problem: a host agent may invoke powerful tools without users being clearly informed of the intended capability set, increasing the chance of unsafe file modification or command execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The usage guidance includes a broad natural-language trigger for invoking experts without clearly defining scope, exclusions, or safety boundaries. Broad triggers can cause the skill to activate in unintended contexts and perform high-impact actions such as installation, update, or file operations when the user did not explicitly request those behaviors.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The installer performs a secondary execution of a Python script as part of installation, which exceeds simple file-copy behavior and introduces additional attack surface. Even if intended for verification, running extra code during install is risky because users may not expect arbitrary post-install execution and a modified verify.py would run automatically.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The description mandates installation of bilingual documentation (Chinese/English), and later states the skill should maintain bilingual support for global accessibility. This imposes a language/locale behavior without explicitly offering the user a choice or opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The only natural-language usage example shown is the Chinese phrase "请专家帮我...". Without accompanying language options or an explicit note that other languages are equally supported, this can be read as favoring a specific language for activation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The final user-facing message suggests only a Chinese phrase: '请专家帮我设计一个产品'. This imposes a specific language in the skill's natural-language guidance without indicating that other languages are supported or giving the user a choice.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.