T08 · Insecure Dependencies
- Location
scripts/update.sh:8- Finding
Mutable npm Package Installed Globally Without Integrity or Provenance Verification
- Content
View full analysis
Vulnerability Details
File Location:
scripts/update.sh:8-26; documented inSKILL.md:12-18,SKILL.md:45-50, andSKILL.md:59-63
Vulnerability Type: Unsafe installation of a mutable third-party dependency
Risk Level: HighVulnerable 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@latestSKILL.md:12-18:bash # Check versions openclaw --version # Current npm show openclaw version # Latest # Update npm install -g openclaw@latestSKILL.md:45-50:bash # 1. Stop gateway openclaw gateway stop # 2. Update npm package npm install -g openclaw@latestSKILL.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
latesttag 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
View remediation
Remediation Suggestions
-
Resolve the intended release and install an exact version rather than the mutable
latesttag: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.
-
Validate the resolved version against a trusted release channel or an administrator-approved version policy before installation.
-
Verify npm provenance, package signatures, or a separately published integrity digest before executing package contents. Fail closed when verification is unavailable or unsuccessful.
-
Disable lifecycle scripts during installation where OpenClaw compatibility permits:
bash npm install -g --ignore-scripts "openclaw@$LATEST" -
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. -
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.
-
Consider downloading the package first, verifying its integrity and provenance in a staging directory, and only then performing the global installation.
-
Document a rollback procedure and retain the previously trusted package version so the gateway can be restored if post-installation verification fails.
-
