# GHSA-w9cg-v44m-4qv8: OpenClaw affected by BASH_ENV / ENV startup-file injection into spawned shell commands

> Attackers with local or privileged influence over environment variables can inject commands into spawned shells, leading to code execution.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Mar 2026

## What is GHSA-w9cg-v44m-4qv8?

GHSA-w9cg-v44m-4qv8 is a command injection vulnerability in openclaw, published on 3 Mar 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

### Summary
`BASH_ENV` / `ENV` startup-file injection could lead to unintended pre-command shell execution when attacker-controlled environment values were admitted and then inherited by host command execution paths.

### Affected Packages / Versions
- Package: `openclaw` (npm)
- Affected: `<= 2026.2.19-2`
- Fixed on `main`: `2cdbadee1f8fcaa93302d7debbfc529e19868ea4`
- Planned patched release version: `2026.2.21`

### Details
The fix hardens environment handling across all relevant execution paths:
- Blocks dangerous startup/runtime env keys and prefixes in shared host env sanitization.
- Sanitizes inherited ambient environment even when no per-request overrides are provided.
- Blocks dangerous config-driven env injection before values enter process environment.
- Uses the same sanitizer in macOS host execution paths.
- Aligns skill env override sanitization with the shared dangerous-env policy.

### Impact
Medium. Exploitation requires local/privileged influence over configuration or environment inputs; there is no standalone remote unauthenticated trigger from this issue alone.

### Fix Commit(s)
- `2cdbadee1f8fcaa93302d7debbfc529e19868ea4`

### Release Process Note
`patched_versions` is pre-set to the planned next release (`2026.2.21`). Once npm `openclaw@2026.2.21` is published, the advisory can be published without further field edits.

OpenClaw thanks @tdjackey for reporting.

## Which versions are affected by GHSA-w9cg-v44m-4qv8?

2 open source packages ship an affected version, including openclaw.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `openclaw` | npm | All versions | 2026.2.21 |
| `openclaw` | npm | All versions | 2026.2.21 |

## How do I fix GHSA-w9cg-v44m-4qv8?

Upgrade openclaw to 2026.2.21 or later.

## Is GHSA-w9cg-v44m-4qv8 being exploited?

There is no known exploitation of GHSA-w9cg-v44m-4qv8 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-w9cg-v44m-4qv8 and fix it if it is affected.

What it is: GHSA-w9cg-v44m-4qv8 is a command injection vulnerability in openclaw, published on 3 Mar 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-w9cg-v44m-4qv8 in the wild and no public exploit code.

Affected packages and fixed versions:
- openclaw (npm): affected all versions; fixed in 2026.2.21
- openclaw (npm): affected all versions; fixed in 2026.2.21

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-w9cg-v44m-4qv8/ (Markdown: https://insights.sbomify.com/GHSA-w9cg-v44m-4qv8/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-w9cg-v44m-4qv8

---
From sbomify Insights: https://insights.sbomify.com/GHSA-w9cg-v44m-4qv8/
Summaries are generated and may contain mistakes; the official description above is the record.
