Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Security: App keys and decrypted env vars written with world-readable permissions

オープン
#606 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
rust
領域
security

調査の方向性

dstack-util/src/system_setup.rs の 1350-1351 行付近にある AppKeys の書き込みと、1409-1419 行付近にある復号済み環境変数の書き込みから始めます。これらのファイルがどのように開かれ、書き込まれているかを読み、新しく書き込まれる秘密ファイルが全員に読み取り可能ではなく、所有者に制限されていることを確認します。両方の書き込みパスが制限の厳しい権限を使用し、既存の Rust チェックが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

security security: hardening security: report

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

  1. Any process inside the CVM can read /path/to/app-keys.json
  2. Attacker compromises any container workload (web vulnerability, dependency exploit, etc.)
  3. Compromised process reads app-keys.json with disk_crypt_key, env_crypt_key, k256_key
  4. 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Dstack-TEE/dstack のほかの issue

Dstack-TEE/dstack の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。