Repository navigation
Disk encryption key and WireGuard key visible in /proc/PID/cmdline #556
Description
The setup_disk_encryption() function in dstack/dstack-util/src/system_setup.rs passes the disk encryption key via the kernel command line when calling cryptsetup, which exposes the key in /proc/cmdline to any process in the CVM.
Root Cause
The disk encryption key is passed to cryptsetup via a shell pipeline that makes it visible in /proc/PID/cmdline:
echo -n "$disk_crypt_key" | cryptsetup luksOpen ...Similarly, the WireGuard private key is passed via wg set command arguments, which are also visible in procfs. Any process inside the CVM can read /proc/*/cmdline to extract these keys during the brief window when the commands are running.
Attack Path
- Attacker compromises any process inside the CVM
- Attacker continuously polls
/proc/*/cmdlinefor processes containing key material - During CVM boot or WireGuard setup, attacker captures the disk encryption key or WireGuard private key
- With the disk encryption key, attacker can decrypt the persistent storage offline
- With the WireGuard key, attacker can decrypt or inject network traffic
Impact
Cryptographic key material is transiently exposed to all processes via procfs. While the window is brief (duration of the cryptsetup/wg commands), a persistent attacker polling procfs can reliably capture the keys.
Suggested Fix
Pass keys via stdin instead of command line arguments or shell pipelines, so no key material appears in /proc/PID/cmdline:
use std::io::Write;
use std::process::{Command, Stdio};
// For cryptsetup: read key from stdin using --key-file=-
let mut child = Command::new("cryptsetup")
.args(["luksOpen", "--key-file", "-", "/dev/vda", "cryptroot"])
.stdin(Stdio::piped())
.spawn()?;
if let Some(mut stdin) = child.stdin.take() {
stdin.write_all(disk_crypt_key.as_bytes())?;
}
let status = child.wait()?;For WireGuard, use wg setconf with a configuration file (on tmpfs with 0o600 permissions) instead of passing the key on the command line.
Note: This issue was created automatically. The vulnerability report was generated by Claude and has not been verified by a human.
Activity
kvinwang commentedon Mar 26, 2026
Thanks for the detailed report.
You are right that the disk encryption key and WireGuard key show up in /proc/PID/cmdline today, but only during the short window while system-setup runs at boot. That helper runs very early in the VM lifecycle, before any user workloads or arbitrary code are started; at that point every process on the system is part of the dstack base image.
Because of that, we do not currently see a realistic attacker who can read /proc during this window without already having compromised the TEE guest itself, in which case the command-line exposure does not materially change the threat model. Still, we agree this is something we can tighten over time and we are tracking it as a hardening opportunity.
h4x3rotab commentedon Jun 30, 2026
Maintainer triage update: this remains open intentionally and is recorded in the public security report table: https://github.com/Dstack-TEE/dstack/blob/master/docs/security/public-security-reports.md#public-reports-and-findings
Disposition: valid hardening, open. This tracks removal of transient command-line exposure for secret-bearing setup commands.