# GHSA-WJ7F-468M-6MV8: Environment variables still accessible through /proc

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2023-12-01
- Modified: 2023-12-01

## Affected versions

- birdcage (crates.io): fixed in 0.7.0

## 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.

## References

- https://github.com/phylum-dev/birdcage/security/advisories/GHSA-wj7f-468m-6mv8
- https://github.com/phylum-dev/birdcage

Page: https://cve.now/GHSA-WJ7F-468M-6MV8

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
