Security: App keys and decrypted env vars written with world-readable permissions
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Bắt đầu trong dstack-util/src/system_setup.rs, tại thao tác ghi AppKeys quanh các dòng 1350-1351 và các thao tác ghi biến môi trường đã giải mã quanh các dòng 1409-1419. Đọc cách các tệp này được mở và ghi, sau đó xác minh rằng các tệp bí mật mới được ghi chỉ bị giới hạn cho chủ sở hữu thay vì có thể được mọi người đọc. Hoàn tất khi cả hai đường dẫn ghi đều sử dụng quyền hạn chế và các kiểm tra Rust hiện có đều vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 551
- Fork
- 97
- Merge trung bình
- 19 giờ 22 phút
- Pull request đã merge (30 ngày)
- 109
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Dstack-TEE/dstack
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Dstack-TEE/dstack#1301 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Dstack-TEE/dstack#1300 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Dstack-TEE/dstack#1299 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Dstack-TEE/dstack#1298 ·
-
P0
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Dstack-TEE/dstack#1297 ·
Tất cả issue của Dstack-TEE/dstack
Issue tương tự
-
bug github_actions
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
registrystack/registry-stack#1393 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
longbridge/gpui-kit#3223 ·
-
bug engine
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
rocky-data/rocky#2181 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
oasisprotocol/oasis-sdk#2523 ·
-
[indexer] [QA] Add a focused test for the new NonRetryableError / assertSocketAlive() behavior. Đang mởbot:ai-assisted component:indexer QA-roadmap status:untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
midnightntwrk/midnight-indexer#1557 ·