Back to skill

Security audit

OpenClaw Self-Update

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but it can replace the installed OpenClaw package from an unpinned npm latest release and restart the gateway without enough safety controls.

Review this before installing. Only use it when you intentionally want the agent to update the global OpenClaw installation and restart the gateway. Prefer choosing an exact version, verifying the release source, avoiding sudo npm install, and having a rollback plan before running the script or copied commands.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Error
Location
scripts/update.sh:8
Finding
Mutable npm Package Installed Globally Without Integrity or Provenance Verification## Vulnerability Details **File Location**: `scripts/update.sh:8-26`; documented in `SKILL.md:12-18`, `SKILL.md:45-50`, and `SKILL.md:59-63` **Vulnerability Type**: Unsafe installation of a mutable third-party dependency **Risk Level**: High ### Vulnerable Code `scripts/update.sh:8-26`: ```bash CURRENT=$(openclaw --version 2>/dev/null || echo "not installed") LATEST=$(npm show openclaw version 2>/dev/null || echo "unknown") echo " Current: $CURRENT" echo " Latest: $LATEST" if [ "$CURRENT" = "$LATEST" ]; then echo "✅ Already on latest version ($CURRENT)" exit 0 fi if [ "$LATEST" = "unknown" ]; then echo "❌ Could not fetch latest version from npm" exit 1 fi echo "" echo "📦 Updating OpenClaw: $CURRENT → $LATEST" echo "" # Update via npm npm install -g openclaw@latest ``` `SKILL.md:12-18`: ```bash # Check versions openclaw --version # Current npm show openclaw version # Latest # Update npm install -g openclaw@latest ``` `SKILL.md:45-50`: ```bash # 1. Stop gateway openclaw gateway stop # 2. Update npm package npm install -g openclaw@latest ``` `SKILL.md:59-63`: ```markdown | Issue | Solution | |-------|----------| | Permission denied | Use `sudo npm install -g openclaw@latest` | ``` ### Technical Analysis The update process installs the package referenced by the mutable npm distribution tag `openclaw@latest`. Although the script queries a version string first, it does not install that resolved version directly and does not verify a package digest, signature, npm provenance attestation, or other trusted release metadata. The `latest` tag can point to a different artifact between the version query and installation. More importantly, compromise of the npm publisher account, package, or release process would allow a malicious package version to be distributed through the same trusted-looking command. npm p ...[truncated 2017 chars]
Remediation
## Remediation Suggestions 1. Resolve the intended release and install an exact version rather than the mutable `latest` tag: ```bash LATEST=$(npm view openclaw version) npm install -g "openclaw@$LATEST" ``` This removes the tag-resolution race but must be combined with the following verification controls. 2. Validate the resolved version against a trusted release channel or an administrator-approved version policy before installation. 3. Verify npm provenance, package signatures, or a separately published integrity digest before executing package contents. Fail closed when verification is unavailable or unsuccessful. 4. Disable lifecycle scripts during installation where OpenClaw compatibility permits: ```bash npm install -g --ignore-scripts "openclaw@$LATEST" ``` 5. Avoid recommending `sudo npm install -g`. Configure a user-owned npm global prefix, use a version manager, or install through a controlled system package process with least privilege. 6. Require explicit user confirmation showing the current version, exact target version, package source, and verification result before modifying the global installation or restarting the gateway. 7. Consider downloading the package first, verifying its integrity and provenance in a staging directory, and only then performing the global installation. 8. Document a rollback procedure and retain the previously trusted package version so the gateway can be restored if post-installation verification fails.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Self-Modification

High
Category
Rogue Agent
Content
---
name: openclaw-self-update
description: Update OpenClaw to the latest version. Use when asked to "update yourself", "upgrade openclaw", "check for updates", or "update to latest version". Handles npm-installed OpenClaw instances.
---
Confidence
94% confidence
Finding
The skill is explicitly designed for self-modification by updating OpenClaw to the latest version. Self-update behavior is inherently dangerous because it allows the agent's executable code to change, potentially introducing unreviewed functionality or compromised upstream code with immediate effect.

Self-Modification

High
Category
Rogue Agent
Content
description: Update OpenClaw to the latest version. Use when asked to "update yourself", "upgrade openclaw", "check for updates", or "update to latest version". Handles npm-installed OpenClaw instances.
---

# OpenClaw Self-Update

Update OpenClaw to the latest version via npm.
Confidence
94% confidence
Finding
The prominent 'Self-Update' instruction reinforces that the skill's purpose is to replace the currently installed agent package. In context, this increases risk because the skill operationalizes code replacement and service restart as routine actions without trust gates or review controls.

Self-Modification

High
Category
Rogue Agent
Content
#!/bin/bash
# OpenClaw Self-Update Script
# Updates OpenClaw to the latest version via npm

set -e
Confidence
92% confidence
Finding
This script performs a self-update by fetching and installing the latest package from npm with `npm install -g openclaw@latest`, which is a real self-modification and remote code supply-chain risk. Even if intended as a legitimate updater, it blindly trusts the npm registry and whatever package is currently tagged `latest`, so a compromised publisher account, dependency, registry path, or malicious release could lead to arbitrary code execution on the host with the privileges used to run the script.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The skill instructs the agent/user to perform package upgrade and service restart operations that modify the system state, but it provides no warning, confirmation requirement, rollback guidance, or trust validation for the package source. In a self-update context, this is risky because it can unexpectedly change runtime behavior, interrupt service availability, or pull unreviewed code from the registry.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Issue | Solution |
|-------|----------|
| Permission denied | Use `sudo npm install -g openclaw@latest` |
| Gateway won't restart | Run `openclaw gateway stop` then `openclaw gateway start` |
| npm not found | Ensure Node.js is installed and in PATH |
Confidence
84% confidence
Finding
The troubleshooting guidance recommends using sudo to install the package globally, which normalizes running a network-fetched package installation with elevated privileges. If the package, dependency chain, registry response, or environment is compromised, this can lead to full system compromise as root.

Static analysis

No suspicious patterns detected.