openclaw
Affected
- introduced
0, fixed2026.3.24(semver)
Fixed versions
2026.3.24
Fix
- Fixed version
2026.3.24npm install [email protected]
Advisory
Also known as: CVE-2026-35641
OpenClaw has an Arbitrary Malicious Code Execution Vulnerability
> Fixed in OpenClaw 2026.3.24, the current shipping release.
Summary
During the installation phase of OpenClaw local plugins/hooks, the Git executable can be hijacked by a project-level .npmrc file, leading to arbitrary code execution during installation.
Details
Please note that the source code locations mentioned below are based on version openclaw-2026.3.13-1, but the issue has been confirmed to still exist in the current latest version, 2026.3.23.
When installing a local plugin directory, local plugin archive, local hook pack directory, or local hook pack archive, OpenClaw first copies the source directory to a temporary stageDir, then executes the following in that directory:
npm install --omit=dev --silent --ignore-scripts
See src/infra/install-package-dir.ts:176-199.
Since this process does not strip the project root .npmrc, and npm reads the project-level .npmrc during local project installation, an attacker could use a .npmrc file in a malicious plugin or hook directory to override npm’s git executable path. By leveraging a Git dependency, the attacker could trigger npm to call this malicious program, thereby executing arbitrary local code during the installation phase.
Affected Paths
src/cli/plugins-cli.ts:199-255src/cli/hooks-cli.ts:573-676src/plugins/install.ts:379-405, src/plugins/install.ts:541-565src/hooks/install.ts:380-403, src/hooks/install.ts:443-470npm install --ignore-scripts: src/infra/install-package-dir.ts:176-199Vulnerability Trigger Flow
openclaw plugins install <path-or-spec>openclaw hooks install <path-or-spec>stageDir. See src/infra/install-package-dir.ts:176-177.dependencies are present in package.json, OpenClaw executes the following in stageDir:npm install --omit=dev --silent --ignore-scripts
See src/infra/install-package-dir.ts:188-199.
.npmrc file in this directory. Official documentation: `.npmrc`.npmrc is set to git=<path to malicious program> and there is a git dependency in the dependency tree, npm will invoke that git program when resolving the dependency. Official documentation: `npm config git` Git dependency documentation: `package.json`Triggering Commands
openclaw plugins install <path-or-spec>
openclaw hooks install <path-or-spec>
When <path-or-spec> is a local directory or local archive, it will be resolved to the path used by the npm install --omit=dev --silent --ignore-scripts command mentioned above.
PoC
Currently, testpoc/ is a minimal PoC directory used to verify that “when installing local packages, OpenClaw enters the npm install --ignore-scripts path.” It is divided into two core sections:
testpoc/pkg/
Purpose: Simulates the local package directory installed by openclaw plugins install ... or openclaw hooks install ...
testpoc/repo/
Purpose: Simulates a Git dependency repository within the npm dependency tree
Directory Structure
testpoc/
├─ pkg/
│ ├─ .npmrc
│ ├─ package.json
│ └─ sample-hook/
│ ├─ HOOK.md
│ └─ handler.js
└─ repo/
├─ package.json
└─ .git/...
Function of Each Component
testpoc/pkg/.npmrc
Current content:
git=calc.exe
Function: Overrides npm’s Git executable configuration.
Meaning: When npm encounters a git dependency during installation, it will not call the system git but will attempt to call the program specified here.
This is the core trigger point of this PoC. See testpoc/pkg/.npmrc:1
testpoc/pkg/package.json
Currently, this is a “mixed-use” manifest that includes both plugin and hook fields:
{
“name”: “probe-host”,
“version”: “1.0.0”,
“private”: true,
“openclaw”: {
“extensions”: [“./dist/index.js”],
“hooks”: [“./sample-hook”]
},
“dependencies”: {
“probe-git-dep”: “git+file:///D:/AI Agent Source/OpenClaw/openclaw-2026.3.13-1/.testpoc/repo”
}
}
Its functionality is divided into three layers:
openclaw.extensions: Allows it to be validated as a plugin package
openclaw.hooks: Enables it to be validated as a hook package
The Git URL in dependencies: Forces npm to enter the Git dependency resolution path during installation
See testpoc/pkg/package.json:1
testpoc/pkg/sample-hook/HOOK.md
Purpose: To meet the minimum metadata requirements for a hook package.
This is the key file that allows openclaw hooks install pkg to pass the pre-check. See testpoc/pkg/sample-hook/HOOK.md:1
testpoc/pkg/sample-hook/handler.js
Current content:
export default async function handler() {
return { ok: true };
}
Purpose: Meets the requirement that the hook directory must contain a handler entry file.
It is not a usage point in itself; its sole purpose is to allow OpenClaw to proceed to the dependency installation phase. See testpoc/pkg/sample-hook/handler.js:1
testpoc/repo/package.json
Current content:
{“name”:“probe-git-dep”,‘version’:“1.0.0”}
Purpose: Serves as the minimum repository content corresponding to a Git dependency.
The focus is not on the repository code itself, but on the fact that “it is a Git repository,” allowing npm to perform Git-related operations on it. See testpoc/repo/package.json:1
testpoc/repo/.git/
Purpose: Makes testpoc/repo/ a real Git repository rather than a regular directory.
When npm resolves git+file://... When installing dependencies, this is treated as the Git source.
How the current PoC works
If installing via hooks:
openclaw hooks install testpoc/pkg
The trigger chain is:
OpenClaw identifies testpoc/pkg as the local hook package path
Through pre-validation in openclaw.hooks, HOOK.md, and handler.js
Proceeds to src/infra/install-package-dir.ts:188-199
Executes:
npm install --omit=dev --silent --ignore-scripts
npm reads testpoc/pkg/.npmrc
npm processes the git dependency in package.json
npm attempts to call the git=calc.exe specified in .npmrc
Impact
It is best described as an installation-time local command execution / unsafe package-install configuration issue.
More precisely:
OpenClaw installs local plugin and hook packs by running npm install --omit=dev --silent --ignore-scripts inside the staged package directory, see src/infra/install-package-dir.ts:188-199.
If that local package directory contains an attacker-controlled .npmrc, npm will still read it.
If .npmrc overrides npm’s git executable and the package has a git dependency, npm can invoke the attacker-chosen program during install.
High Basis: The source's own band: HIGH
0, fixed 2026.3.24 (semver)2026.3.24
2026.3.24npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0