Back to skill

Security audit

OpenClaw Upgrade Fix

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real OpenClaw upgrade/maintenance helper, but it includes high-impact automatic changes that can broaden agent privileges and modify sensitive local state without enough user control.

Review before installing or running. Run these scripts only if you intentionally want OpenClaw to use the full tool profile, are comfortable with a global npm upgrade to the latest package, and understand that auth, memory, and configuration files may be copied into backups while plugin runtime directories may be deleted.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/post-upgrade-fix.sh:38
Finding

Automatic Expansion of Agent Tool Privileges

Content
View full analysis
/dev/null) if [ "$TOOLS_PROFILE" != "full" ]; then echo "⚠️ tools.profile 是 '$TOOLS_PROFILE',正在修复为 'full'..." python3 << 'PYEOF' "$CONFIG_FILE" 2>/dev/null import json, sys config_file = sys.argv[1] with open(config_file, 'r') as f: config = json.load(f) config.setdefault('tools', {})['profile'] = 'full' with open(config_file, 'w') as f: json.dump(config, f, indent=2) print("✅ tools.profile 已修复为 full") PYEOF log "修复了 tools.profile" else echo "✅ tools.profile = full" fi ``` ### Technical Analysis The post-upgrade repair script treats every profile other than `full` as defective and unconditionally rewrites the OpenClaw configuration to grant the broad `full` tool profile. This operation does not preserve an intentionally restricted profile and does not obtain explicit user authorization before expanding access. The accompanying documentation also presents powerful capabilities such as `exec`, `gateway`, and `browser` as expected permissions. These capabilities are not inherently required merely to validate or repair an installation. Automatically enabling a broad tool profile violates least privilege and increases the consequences of later prompt injection, malicious plugin behavior, or unauthorized Agent requests. ### Attack Path 1. An administrator intentionally configures the Agent with a restricted profile such as `messaging`. 2. The user runs `scripts/post-upgrade-fix.sh` after an upgrade. 3. The script detects that the profile is not `full`. 4. The script changes `t ...[truncated 999 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Error
Location
scripts/upgrade.sh:51
Finding

Unpinned Global Installation from a Mutable Package Tag

Content
View full analysis
&1 | tee -a "$LOG_FILE" if [ ${PIPESTATUS[0]} -ne 0 ]; then echo "❌ npm 安装失败" log "npm 安装失败" exit 1 fi ``` ### Technical Analysis The script globally installs `openclaw@latest`. The `latest` npm distribution tag is mutable, so the code installed during one execution may differ from the code reviewed or installed during a previous execution. No exact version, expected package digest, provenance, or signature is verified before installation. npm installations may execute package lifecycle scripts. A compromised publisher account, registry entry, release pipeline, or newly published defective version could therefore cause arbitrary package-controlled code to execute with the privileges of the user running the upgrade. The global installation also replaces the OpenClaw executable available to the account or system. The command additionally uses `--no-audit`, suppressing npm's dependency vulnerability audit during this security-sensitive update operation. ### Attack Path 1. An attacker compromises the upstream package publisher, release process, or registry metadata, or publishes a malicious release under control of the legitimate package namespace. 2. The mutable `latest` tag is changed to reference the affected release. 3. A user executes `scripts/upgrade.sh`. 4. npm resolves `openclaw@latest` to the attacker-controlled or compromised release. 5. Package contents and any lifecycle scripts execute during global installation. 6. The compromised OpenClaw executable is subsequently invoked to obtain its version and restart or manage the Gateway. The repository itself does n ...[truncated 541 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/upgrade.sh:35
Finding

Sensitive Credentials and Agent State Are Backed Up Without Explicit Permission Hardening

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/post-upgrade-fix.sh:20
Finding

Unsafe Recursive Deletion Based on Parsed ls Output and Broad Wildcards

Content
View full analysis
/dev/null | grep -v "$(openclaw --version 2>/dev/null | head -1 | cut -d' ' -f2)" || true) if [ -n "$OLD_DIRS" ]; then echo "发现旧版本插件目录:" echo "$OLD_DIRS" echo "" echo "正在清理..." for dir in $OLD_DIRS; do rm -rf "$dir" echo " ✅ 已删除: $(basename $dir)" done log "清理了 $(echo "$OLD_DIRS" | wc -l) 个旧插件目录" else echo "✅ 没有旧的插件目录" fi ``` ### Technical Analysis The deletion candidates are produced by parsing `ls` output into a shell variable and iterating over the variable with unquoted word splitting. Directory names containing spaces, tabs, or newline characters will not be preserved as single paths. Parsing `ls` is not a safe mechanism for filesystem traversal. The wildcard `openclaw-2026.*` is broad and may select valid directories. The current version is excluded with `grep -v` using text derived from command output rather than an exact, structured version comparison. This can produce false matches or false exclusions if version formatting changes or if a path contains the current version as a substring. Each resulting candidate is passed to `rm -rf` without canonicalization, an explicit directory check, validation that the resolved path remains beneath `PLUGIN_DEPS`, or user confirmation. ### Attack Path 1. A legitimate process or local attacker creates a directory under `~/.openclaw/plugin-runtime-deps` whose name matches `openclaw-unknown-*` or `openclaw-2026.*`. 2. The directory is valid, specially named, or crafted so that text-based version filtering does not identify it as the active directory. 3. The user runs `scripts/post-upgrade-fix.sh`. 4. `ls`, `grep`, and shell word splitting produce deleti ...[truncated 929 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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 (15)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

Even beyond the generic rm -rf ~ pattern match, the specific command rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-unknown-* is operationally dangerous because it trusts a wildcard and performs irreversible deletion in a user-controlled filesystem location. If the directory structure is unexpected or contains linked/shared content, the impact can extend beyond stale plugin artifacts.

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

修复:

bash
# 清理旧的插件运行时目录
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-unknown-*
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.*
openclaw gateway restart

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

Even beyond the generic rm -rf ~ pattern match, the specific command rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-unknown-* is operationally dangerous because it trusts a wildcard and performs irreversible deletion in a user-controlled filesystem location. If the directory structure is unexpected or contains linked/shared content, the impact can extend beyond stale plugin artifacts.

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

修复:

bash
# 清理旧的插件运行时目录
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-unknown-*
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.*
openclaw gateway restart

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

The command rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.* is an unsafe destructive pattern because it combines force, recursion, and wildcard expansion in a maintenance guide aimed at routine use. The context makes it more dangerous, not less, because the skill normalizes running the command as a fix for a common issue, which may lead users to execute it without understanding deletion scope.

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

bash
# 清理旧的插件运行时目录
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-unknown-*
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.*
openclaw gateway restart

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

The command rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.* is an unsafe destructive pattern because it combines force, recursion, and wildcard expansion in a maintenance guide aimed at routine use. The context makes it more dangerous, not less, because the skill normalizes running the command as a fix for a common issue, which may lead users to execute it without understanding deletion scope.

Content

Scanner excerpt · SKILL.md (reported line 67)May include surrounding context.

bash
# 清理旧的插件运行时目录
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-unknown-*
rm -rf ~/.openclaw/plugin-runtime-deps/openclaw-2026.4.*
openclaw gateway restart

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script presents itself as a post-upgrade repair utility, but in step 2 it silently rewrites the user's configuration to set tools.profile to 'full'. That changes the security posture by granting broader tool permissions than the user may have chosen, creating a privilege-escalation-by-configuration issue under the guise of a fix.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill documents recursive deletion commands against directories under the user's home folder without an explicit warning, confirmation step, or safer validation pattern. Even if intended as routine maintenance, these commands can cause irreversible data loss if the path expands unexpectedly, the glob matches more than intended, or a user copies the pattern into a slightly different environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The instructions directly modify ~/.openclaw/openclaw.json to force tools.profile to full, but do not clearly warn that this overwrites local security settings and broadens execution privileges. This is risky because users may unknowingly weaken their local security posture or corrupt the config if the expected JSON structure is absent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The restore instructions copy a backup file over the active configuration without warning that current settings will be replaced. This can silently discard recent configuration changes, credentials, or environment-specific adjustments and may leave the user with a stale or incompatible config.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script’s user-facing comments and console messages are written entirely in Chinese, including status output and remediation guidance. This imposes a specific language on users without any opt-in or documented locale constraint, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Natural-language comments and terminal output throughout the script are presented only in Chinese, which can amount to a language/locale policy violation when no opt-in or justification is provided. The file does not indicate that this skill is region-specific or that users can select their preferred language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This shell script presents its title, status messages, and instructions in Chinese, starting with the header comments and continuing throughout the user-facing echo statements. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation unless the script is clearly documented as region-specific, which is not shown here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description, headings, warnings, and operational guidance are entirely in Chinese. Under the policy, forcing a specific language without user opt-in or a clearly documented regional justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The rollback section instructs users to copy a backup over the live configuration and restart the gateway, which is an integrity-impacting operation. Unlike the general caution earlier about openclaw doctor, this section does not explicitly warn that rollback replaces current settings and may revert recent changes.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The inline documentation says this section checks exec permissions, which implies a real permission validation. In practice, the code merely reads a config list entry and prints whether 'exec' appears there, so the comment overstates what is being validated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
12% confidence
Finding

Although the script performs a destructive operation with rm -rf, it clearly announces the cleanup step and lists directories before deletion. The rule requires lack of any disclosure, which is not the case here.

Content

No source excerpt is available for this finding.