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.
