Security: App keys and decrypted env vars written with world-readable permissions
まだ誰も着手していません。
評価
調査の方向性
dstack-util/src/system_setup.rs の 1350-1351 行付近にある AppKeys の書き込みと、1409-1419 行付近にある復号済み環境変数の書き込みから始めます。これらのファイルがどのように開かれ、書き込まれているかを読み、新しく書き込まれる秘密ファイルが全員に読み取り可能ではなく、所有者に制限されていることを確認します。両方の書き込みパスが制限の厳しい権限を使用し、既存の Rust チェックが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Note: This issue documents a vulnerability that was originally reported privately as the repository security advisory GHSA-535m-2x67-prhm by @pbeza.
Root Cause
fs::write() is used with default permissions (0o644) to write AppKeys to the filesystem. The AppKeys structure contains disk_crypt_key, env_crypt_key, and k256_key — all highly sensitive cryptographic secrets. Similarly, decrypted environment variables are written to files with default world-readable permissions.
// Default fs::write() creates files with 0o644 permissions
fs::write(&app_keys_path, serde_json::to_string(&app_keys)?)?;
Attack Path
- Any process inside the CVM can read
/path/to/app-keys.json - Attacker compromises any container workload (web vulnerability, dependency exploit, etc.)
- Compromised process reads
app-keys.jsonwithdisk_crypt_key,env_crypt_key,k256_key - Attacker can decrypt the disk, decrypt environment variables, and use the k256 signing key
Impact
Any compromised process inside the CVM can read all application cryptographic keys and decrypted environment variables. This includes the disk encryption key (enables offline disk reading), the env encryption key (decrypts all environment secrets), and the k256 key (enables signing as the CVM).
Suggested Fix
Set restrictive permissions before writing:
use std::os::unix::fs::OpenOptionsExt;
let mut file = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.mode(0o600)
.open(&app_keys_path)?;
file.write_all(serde_json::to_string(&app_keys)?.as_bytes())?;
Consider further restricting to 0o400 (read-only by owner) after the initial write.
Note: This finding was reported automatically as part of an AI/Claude-driven internal audit by the NEAR One MPC team. It has not been manually verified by a human to confirm whether it constitutes an actual security issue.
- 主要言語
- Rust
- スター
- 551
- フォーク
- 97
- 平均マージ
- 19時間 22分
- マージ済み PR(30日)
- 109
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Dstack-TEE/dstack のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 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 ·
-
P0
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Dstack-TEE/dstack#1297 ·
Dstack-TEE/dstack の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
yantrikos/yantrik-os#255 ·
-
bug CLI custom-model
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
raphamorim/rio#1956 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
rust-bitcoin/rust-bitcoin#6930 · コメント 1 件 ·