Arbitrary Hook Code Execution in OpenClaw via OPENCLAW_BUNDLED_HOOKS_DIR Override
CVE-2026-41336 affects OpenClaw versions before 2026.3.31. The vulnerability arises because a workspace-local .env file can override the OPENCLAW_BUNDLED_HOOKS_DIR environment variable, which controls the directory from which bundled hooks are loaded. By supplying an untrusted workspace containing a crafted .env file, an attacker can redirect OpenClaw to load attacker-controlled hook code in place of trusted default-on bundled hooks. This results in arbitrary code execution in the context of the user running OpenClaw when the malicious workspace is opened or otherwise processed with the affected hook-loading behavior.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation allows arbitrary code execution through attacker-controlled hook loading. Because the malicious code is executed as hook code within OpenClaw, an attacker can compromise the confidentiality, integrity, and availability of the affected user's environment and data accessible to the OpenClaw process. The provided CVSS vectors indicate high impact to confidentiality, integrity, and availability.
If you can’t patch tonight, do this now.
Do not open or process untrusted workspaces with vulnerable OpenClaw versions. Prevent workspace-provided .env files from influencing runtime environment variables, especially OPENCLAW_BUNDLED_HOOKS_DIR. Where operationally feasible, disable or restrict automatic/default-on hook loading, and run OpenClaw only with trusted workspaces until the patched version is deployed.
Patch, then assume compromise.
Upgrade OpenClaw to version 2026.3.31 or later, which addresses the unsafe ability of workspace .env files to override OPENCLAW_BUNDLED_HOOKS_DIR for bundled hook resolution. Apply the vendor fix referenced by the associated GitHub commit and security advisory.
No public exploits tracked yet. Mallory keeps watching.
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
4 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.