Disk encryption key and WireGuard key visible in /proc/PID/cmdline
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- linux, rust
调研方向
检查 dstack/dstack-util/src/system_setup.rs,从 setup_disk_encryption() 以及调用 wg set 的 WireGuard 设置开始。验证磁盘加密密钥和 WireGuard 密钥是否出现在 /proc/*/cmdline 中,然后评估 cryptsetup 和 setconf 的 stdin,并为 WireGuard 使用受保护的临时配置。完成的标准是两个密钥都不会作为命令行参数或通过 shell 管道传递,并且现有设置仍能成功完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Rust
- 星标
- 551
- 派生
- 97
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 182
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Dstack-TEE/dstack 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
Dstack-TEE/dstack#1384 ·
-
难度 5/5 一周以上 新手友好度 30/100
Dstack-TEE/dstack#1301 ·
-
难度 3/5 1-2 天 新手友好度 55/100
Dstack-TEE/dstack#1300 ·
-
难度 4/5 3-5 天 新手友好度 48/100
Dstack-TEE/dstack#1299 ·
-
难度 4/5 3-5 天 新手友好度 48/100
Dstack-TEE/dstack#1298 ·
查看 Dstack-TEE/dstack 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
TheLarkInn/aipm#2413 ·
-
documentation
难度 1/5 1 小时以内 新手友好度 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
难度 2/5 1-3 小时 新手友好度 75/100
-
todo:ticket
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
taikoxyz/taiko-mono#22168 · 1 条评论 ·