Description
OpenClaw before 2026.3.31 allows workspace .env files to override the OPENCLAW_BUNDLED_HOOKS_DIR environment variable, enabling loading of attacker-controlled hook code. Attackers can replace trusted default-on bundled hooks from untrusted workspaces to execute arbitrary code.
Published: 2026-04-23
Score: 8.5 High
EPSS: < 1% Very Low
KEV: No
Impact: Arbitrary Code Execution via Environment Variable Override
Action: Apply Patch
AI Analysis

Impact

OpenClaw before 2026.3.31 is vulnerable because it allows the OPENCLAW_BUNDLED_HOOKS_DIR environment variable to be overridden by an attacker supplied workspace .env file. The override causes the application to load hook code from directories specified by the attacker rather than the trusted default hooks. This permits an attacker to inject and execute arbitrary code on the host running the workspace. The vulnerability originates from inadequate access control over environment configuration, matching CWE-829.

Affected Systems

Any installation of OpenClaw older than version 2026.3.31 is impacted; all other versions are considered safe.

Risk and Exploitability

The CVSS score of 8.5 indicates a high severity flaw, while the EPSS score of less than 1% shows that, as of now, exploitation is unlikely to be widespread. Nonetheless, because an attacker only needs to supply a crafted .env file in a workspace, the server could load malicious hook code and execute it without further interaction. The vulnerability is not listed in the CISA KEV catalog, so there is no evidence of existing widespread exploits, yet the potential for uncontrolled code execution remains significant, especially in environments where workspaces are created or managed by trusted users only.

Generated by OpenCVE AI on April 28, 2026 at 14:40 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade OpenClaw to version 2026.3.31 or later, which removes the ability to override the bundled hooks directory via .env files.
  • If upgrading immediately is not possible, configure the application to ignore or remove the OPENCLAW_BUNDLED_HOOKS_DIR environment variable when loading hooks, effectively disabling the override.
  • Restrict the creation or modification of workspace .env files to trusted administrators; consider implementing a signing or validation mechanism to prevent unauthorized changes.
  • Apply file permission controls or monitoring to detect unexpected .env files or changes to the hooks directory, and restrict write access to the bundled hooks directory.

Generated by OpenCVE AI on April 28, 2026 at 14:40 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-3qpv-xf3v-mm45 OpenClaw: Workspace `.env` can override the bundled hooks root and load attacker hook code
History

Thu, 23 Apr 2026 22:15:00 +0000

Type Values Removed Values Added
Description OpenClaw before 2026.3.31 allows workspace .env files to override the OPENCLAW_BUNDLED_HOOKS_DIR environment variable, enabling loading of attacker-controlled hook code. Attackers can replace trusted default-on bundled hooks from untrusted workspaces to execute arbitrary code.
Title OpenClaw < 2026.3.31 - Arbitrary Hook Code Execution via OPENCLAW_BUNDLED_HOOKS_DIR Environment Variable Override
First Time appeared Openclaw
Openclaw openclaw
Weaknesses CWE-829
CPEs cpe:2.3:a:openclaw:openclaw:*:*:*:*:*:node.js:*:*
Vendors & Products Openclaw
Openclaw openclaw
References
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 8.5, 'vector': 'CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Subscriptions

Openclaw Openclaw
cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-04-24T11:03:12.589Z

Reserved: 2026-04-20T14:03:06.200Z

Link: CVE-2026-41336

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Analyzed

Published: 2026-04-23T22:16:39.603

Modified: 2026-04-28T18:55:54.533

Link: CVE-2026-41336

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-04-28T14:45:16Z

Weaknesses