# GHSA-wj7f-468m-6mv8: Environment variables still accessible through /proc

> Attackers can read sensitive environment variables from /proc/self/environ within the Birdcage sandbox, bypassing intended isolation.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Dec 2023

## What is GHSA-wj7f-468m-6mv8?

GHSA-wj7f-468m-6mv8 is a vulnerability in birdcage, published on 1 Dec 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

### Impact

Environment variables can be read from procfs unless a new process is started.

### PoC

```
use birdcage::{Birdcage, Sandbox};
use std::{env, fs};

fn main() {
    Birdcage::new().lock().unwrap();

    assert_eq!(env::var_os("SECRET"), None);

    let environ = fs::read_to_string("/proc/self/environ").unwrap();
    assert!(!environ.contains("SECRET"), "ENVIRON CONTAINS SECRET:\n{environ}");
}
```

```
$  SECRET=test cargo run
thread 'main' panicked at src/main.rs:10:5:
ENVIRON CONTAINS SECRET:
 [truncated]
 ```

### Possible Solutions

The simplest solution would be relying on the ptrace isolation and **always** spawning a new process by changing birdcage's API to create a new command. With an additional PID namespace the guarantees could be even further reinforced.

## Which versions are affected by GHSA-wj7f-468m-6mv8?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `birdcage` | crates.io | All versions | 0.7.0 |
| `birdcage` | crates.io | All versions | 0.7.0 |

## How do I fix GHSA-wj7f-468m-6mv8?

Upgrade birdcage to 0.7.0 or later.

## Is GHSA-wj7f-468m-6mv8 being exploited?

There is no known exploitation of GHSA-wj7f-468m-6mv8 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-wj7f-468m-6mv8 and fix it if it is affected.

What it is: GHSA-wj7f-468m-6mv8 is a vulnerability in birdcage, published on 1 Dec 2023. 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-wj7f-468m-6mv8 in the wild and no public exploit code.

Affected packages and fixed versions:
- birdcage (crates.io): affected all versions; fixed in 0.7.0
- birdcage (crates.io): affected all versions; fixed in 0.7.0

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-wj7f-468m-6mv8/ (Markdown: https://insights.sbomify.com/GHSA-wj7f-468m-6mv8/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-wj7f-468m-6mv8

---
From sbomify Insights: https://insights.sbomify.com/GHSA-wj7f-468m-6mv8/
Summaries are generated and may contain mistakes; the official description above is the record.
