CVE-2026-41332: OpenClaw host-env blocklist missing `GIT_TEMPLATE_DIR` and `AWS_CONFIG_FILE` allows code execution via env override
OpenClaw's host-exec environment filter did not block GIT_TEMPLATE_DIR or AWS_CONFIG_FILE. An approved exec request could set either one to point git or the AWS CLI at attacker-controlled files, running untrusted code or loading attacker-chosen credentials. OpenClaw 2026.3.24 and earlier is affected. Upgrade to 2026.3.28.
Published Mar 31, 2026 · Updated May 6, 2026 · Analysis Oct 31, 2026
What an attacker can do
OpenClaw sanitizes the environment passed to commands it runs on the host. It uses a blocklist in src/infra/host-env-security-policy.json, applied by src/infra/host-env-security.ts. The list was incomplete (CWE-184). GIT_TEMPLATE_DIR and AWS_CONFIG_FILE passed through, and both redirect trusted tools to attacker-controlled content.
GIT_TEMPLATE_DIR tells git where to copy template files from when it clones or inits a repository. A template can carry hooks such as post-checkout, so a git clone with a hostile template runs the attacker's script. AWS_CONFIG_FILE points the AWS CLI at another config, which can supply attacker-selected credentials or settings.
The advisory says the trigger is an approved exec request carrying the override. In practice, a prompt-injected or malicious agent turn that asks to run a command with these variables, and gets approved, can turn a harmless-looking git or aws call into code execution. The CVSS vector is network, high complexity, low privileges with a changed scope, which matches the need for an approved request.
Who is affected
The openclaw npm package at 2026.3.24 and earlier. Any setup where agents can request host command execution with environment overrides is in scope. Check the version:
npm ls openclaw
openclaw --versionThe advisory does not list other affected configurations.
openclaw
- Ecosystem
- npm
- Affected
- <= 2026.3.24
- Fixed in
- 2026.3.28
- Check
npm ls openclaw
How to fix it
Upgrade to openclaw 2026.3.28 or later:
npm install -g [email protected]Commit 6eb82fba3c ("Infra: block additional host exec env keys") adds GIT_TEMPLATE_DIR and AWS_CONFIG_FILE to the blocklist in the JSON policy and in the generated Swift policy for the macOS app. sanitizeHostExecEnv now removes both. A regression test clones a repository with an inherited GIT_TEMPLATE_DIR and a post-checkout hook, and checks that the hook no longer fires. The advisory lists no workaround.
How to tell if you were hit
Review exec approval history and agent transcripts for commands that set GIT_TEMPLATE_DIR or AWS_CONFIG_FILE. Look for unexpected hook files (for example post-checkout) in directories created by git clone or git init, and for AWS CLI calls that used an unfamiliar config file or profile. Check cloud audit logs for activity under credentials you did not expect.
Beam records agent shell commands and file access, and its rules can flag risky commands, so a command that sets these variables would show up in its record.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
Host execution env sanitization did not block GIT_TEMPLATE_DIR or AWS_CONFIG_FILE, even though both can redirect trusted tooling to attacker-controlled content.
Impact
An approved exec request could redirect git or AWS CLI behavior through attacker-controlled configuration and execute untrusted code or load attacker-selected credentials.
Affected Component
src/infra/host-env-security-policy.json, src/infra/host-env-security.ts
Fixed Versions
- Affected:
<= 2026.3.24 - Patched:
>= 2026.3.28 - Latest stable
2026.3.28contains the fix.
Fix
Fixed by commit 6eb82fba3c (Infra: block additional host exec env keys).
OpenClaw thanks @nicky-cc of Tencent zhuque Lab https://github.com/Tencent/AI-Infra-Guard for reporting.
Credited to nicky-cc.
Questions
- Does CVE-2026-41332 need the user to approve a command?
Yes. The advisory describes an approved exec request. The flaw is that the environment filter let these two variables through once a request was approved.
- What does the fix block?
GIT_TEMPLATE_DIR and AWS_CONFIG_FILE are added to the host-exec env blocklist. They are removed from the environment, in upper and lower case, before the command runs.
- Which version is patched?
openclaw 2026.3.28. Versions up to and including 2026.3.24 are vulnerable.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More OpenClaw vulnerabilities
All OpenClaw entriesCVE-2026-62197
OpenClaw: Browser CDP discovery could accept blocked WebSocket URLs
medium8.5Oct 21, 2026CVE-2026-35630
OpenClaw: QQBot native approval buttons did not enforce configured approver identity
high8.0Jul 2, 2026CVE-2026-53806
OpenClaw: Combined POSIX shell options could confuse exec revalidation
high8.8Jul 2, 2026CVE-2026-53809
OpenClaw: Embedded runner policy could be confused by provider aliases
medium3.8Jul 2, 2026CVE-2026-53810
OpenClaw's marketplace runtime extension metadata could point at unscanned payloads
high8.8Jul 2, 2026CVE-2026-53811
OpenClaw: Matrix allowFrom could bind to mutable display names
high8.8Jul 2, 2026
