CVE-2026-53842: OpenClaw: env var injection enables arbitrary code exec
HIGHOpenClaw before version 2026.5.2 contains an environment variable injection flaw (CWE-426) where an attacker with repository write access can place a malicious CLOUDSDK_PYTHON value in a workspace .env file, hijacking the Python runtime invoked during Gmail/gcloud setup and achieving arbitrary code execution on the victim's machine. The local attack vector and required user interaction keep the CVSS at 7.1, but in shared repositories or CI/CD pipelines this translates to a realistic insider-threat or repository-compromise scenario — OpenClaw agents typically run with cloud credentials during setup, meaning a successful exploit exposes Google Cloud service accounts and any downstream AI infrastructure connected through the agent's toolchain. No public exploit or CISA KEV listing exists today, yet the exploitation path is trivial: a single .env file line with no special tooling required. Upgrade to OpenClaw 2026.5.2+ immediately and audit all workspace .env files for unexpected CLOUDSDK_PYTHON entries; enforce repository access controls and add pre-commit hooks that flag modifications to this variable.
What is the risk?
Medium-high risk in collaborative development environments. The local attack vector and user-interaction requirement limit exposure compared to network-exploitable CVEs, but AI agent frameworks like OpenClaw routinely run with cloud credentials and elevated system access during provisioning phases. The exploitation technique — injecting a single environment variable into a .env file — requires minimal attacker skill, making insider threat and supply-chain scenarios realistic for any team sharing OpenClaw workspaces. CI/CD pipelines that automate agent setup are the highest-risk surface because execution can occur without developer review.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| OpenClaw | pip | — | No patch |
Do you use OpenClaw? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
Patch: Upgrade to OpenClaw 2026.5.2 or later immediately — this is the primary remediation.
-
Audit: Scan all workspace .env files for any non-empty CLOUDSDK_PYTHON value; treat any such entry as suspect unless explicitly set by your security team.
-
Access control: Restrict write access to workspace configuration files in shared repositories and enforce mandatory code review for any .env changes.
-
Detection: Implement pre-commit hooks or CI pipeline checks that flag additions or modifications to CLOUDSDK_PYTHON in .env files and alert the security team.
-
Isolation: Run OpenClaw Gmail/gcloud setup workflows inside containers or sandboxed environments where environment variables cannot reference arbitrary host paths and cloud credential exposure is minimized.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-53842?
OpenClaw before version 2026.5.2 contains an environment variable injection flaw (CWE-426) where an attacker with repository write access can place a malicious CLOUDSDK_PYTHON value in a workspace .env file, hijacking the Python runtime invoked during Gmail/gcloud setup and achieving arbitrary code execution on the victim's machine. The local attack vector and required user interaction keep the CVSS at 7.1, but in shared repositories or CI/CD pipelines this translates to a realistic insider-threat or repository-compromise scenario — OpenClaw agents typically run with cloud credentials during setup, meaning a successful exploit exposes Google Cloud service accounts and any downstream AI infrastructure connected through the agent's toolchain. No public exploit or CISA KEV listing exists today, yet the exploitation path is trivial: a single .env file line with no special tooling required. Upgrade to OpenClaw 2026.5.2+ immediately and audit all workspace .env files for unexpected CLOUDSDK_PYTHON entries; enforce repository access controls and add pre-commit hooks that flag modifications to this variable.
Is CVE-2026-53842 actively exploited?
No confirmed active exploitation of CVE-2026-53842 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-53842?
1. Patch: Upgrade to OpenClaw 2026.5.2 or later immediately — this is the primary remediation. 2. Audit: Scan all workspace .env files for any non-empty CLOUDSDK_PYTHON value; treat any such entry as suspect unless explicitly set by your security team. 3. Access control: Restrict write access to workspace configuration files in shared repositories and enforce mandatory code review for any .env changes. 4. Detection: Implement pre-commit hooks or CI pipeline checks that flag additions or modifications to CLOUDSDK_PYTHON in .env files and alert the security team. 5. Isolation: Run OpenClaw Gmail/gcloud setup workflows inside containers or sandboxed environments where environment variables cannot reference arbitrary host paths and cloud credential exposure is minimized.
What systems are affected by CVE-2026-53842?
This vulnerability affects the following AI/ML architecture patterns: AI agent frameworks, Developer workstation environments, CI/CD pipelines, Cloud-integrated agent deployments.
What is the CVSS score for CVE-2026-53842?
CVE-2026-53842 has a CVSS v3.1 base score of 7.1 (HIGH).
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.005 AI Agent Tool AML.T0011 User Execution AML.T0050 Command and Scripting Interpreter AML.T0055 Unsecured Credentials AML.T0081 Modify AI Agent Configuration Compliance Controls Affected
What are the technical details?
Original Advisory
OpenClaw before 2026.5.2 contains an environment variable injection vulnerability allowing workspace .env files to influence Python runtime selection through CLOUDSDK_PYTHON during Gmail setup gcloud execution. Attackers with repository access can manipulate the CLOUDSDK_PYTHON variable to execute setup through unintended local Python paths, potentially enabling arbitrary code execution.
Exploitation Scenario
A malicious insider or attacker who has compromised a contributor account in a shared OpenClaw repository adds the line CLOUDSDK_PYTHON=/tmp/.backdoor/python to the workspace .env file via a pull request with unrelated changes. When a developer clones the repository and runs the Gmail setup workflow, or when a CI/CD pipeline executes it automatically, OpenClaw loads the workspace .env and passes CLOUDSDK_PYTHON to the gcloud invocation. gcloud uses the attacker-controlled binary instead of the system Python — executing arbitrary code with the privileges of the setup process. The attacker's payload harvests Google Cloud service account credentials stored in the environment, exfiltrates them to an external endpoint, and establishes persistence for ongoing access to the team's cloud AI infrastructure.
Weaknesses (CWE)
CWE-426 — Untrusted Search Path: The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control.
- [Architecture and Design, Implementation] Hard-code the search path to a set of known-safe values (such as system directories), or only allow them to be specified by the administrator in a configuration file. Do not allow these settings to be modified by an external party. Be careful to avoid related weaknesses such as CWE-426 and CWE-428.
- [Implementation] When invoking other programs, specify those programs using fully-qualified pathnames. While this is an effective approach, code that uses fully-qualified pathnames might not be portable to other systems that do not use the same pathnames. The portability can be improved by locating the full-qualified paths in a centralized, easily-modifiable location within the source code, and having the code refer to these paths.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N References
Timeline
Related Vulnerabilities
CVE-2026-30741 9.8 OpenClaw: RCE via request-side prompt injection
Same package: openclaw CVE-2026-53838 9.8 OpenClaw: approval scope bypass via reconnection state
Same package: openclaw CVE-2026-28451 9.3 OpenClaw: SSRF via Feishu extension exposes internal services
Same package: openclaw GHSA-cwj3-vqpp-pmxr 8.8 openclaw: Model bypasses authz to persist unsafe config
Same package: openclaw CVE-2026-35674 8.8 OpenClaw: scope bypass enables full agent admin takeover
Same package: openclaw