diff --git a/Cargo.lock b/Cargo.lock index 98270b4..3334f61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -428,12 +428,15 @@ dependencies = [ name = "enclaveapp-apple" version = "0.1.0" dependencies = [ + "aes-gcm", "base64 0.22.1", "dirs", "enclaveapp-core", "libc", + "rand 0.9.4", "serde", "serde_json", + "tracing", ] [[package]] @@ -462,9 +465,11 @@ dependencies = [ "libc", "serde", "serde_json", + "sha2", "thiserror", "toml 0.8.23", "tracing", + "windows", ] [[package]] @@ -481,6 +486,7 @@ dependencies = [ "serde", "serde_json", "sha2", + "zeroize", ] [[package]] @@ -1368,6 +1374,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", + "windows", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index eaac4ab..0c36668 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,15 +29,15 @@ sshenc-agent = { path = "crates/sshenc-agent" } sshenc-test-support = { path = "crates/sshenc-test-support" } # libenclaveapp (shared hardware-backed key management) -enclaveapp-core = { path = "../crates/enclaveapp-core" } -enclaveapp-apple = { path = "../crates/enclaveapp-apple", features = ["signing"] } -enclaveapp-windows = { path = "../crates/enclaveapp-windows", features = ["signing"] } -enclaveapp-keyring = { path = "../crates/enclaveapp-keyring", features = ["signing"] } -enclaveapp-linux-tpm = { path = "../crates/enclaveapp-linux-tpm", features = ["signing"] } -enclaveapp-wsl = { path = "../crates/enclaveapp-wsl" } -enclaveapp-app-storage = { path = "../crates/enclaveapp-app-storage" } -enclaveapp-build-support = { path = "../crates/enclaveapp-build-support" } -enclaveapp-tpm-bridge = { path = "../crates/enclaveapp-tpm-bridge" } +enclaveapp-core = { path = "../libenclaveapp/crates/enclaveapp-core" } +enclaveapp-apple = { path = "../libenclaveapp/crates/enclaveapp-apple", features = ["signing"] } +enclaveapp-windows = { path = "../libenclaveapp/crates/enclaveapp-windows", features = ["signing"] } +enclaveapp-keyring = { path = "../libenclaveapp/crates/enclaveapp-keyring", features = ["signing"] } +enclaveapp-linux-tpm = { path = "../libenclaveapp/crates/enclaveapp-linux-tpm", features = ["signing"] } +enclaveapp-wsl = { path = "../libenclaveapp/crates/enclaveapp-wsl" } +enclaveapp-app-storage = { path = "../libenclaveapp/crates/enclaveapp-app-storage" } +enclaveapp-build-support = { path = "../libenclaveapp/crates/enclaveapp-build-support" } +enclaveapp-tpm-bridge = { path = "../libenclaveapp/crates/enclaveapp-tpm-bridge" } # Serialization serde = { version = "1", features = ["derive"] } diff --git a/THREAT_MODEL.md b/THREAT_MODEL.md index 4bc2c42..fb306a9 100644 --- a/THREAT_MODEL.md +++ b/THREAT_MODEL.md @@ -242,12 +242,15 @@ descriptor) can accept SSH clients' signing requests. before starting `sshenc-agent`, so clients connect to `sshenc`. - `sshenc-agent` uses `ServerOptions::first_pipe_instance(true)` and refuses to attach to an existing pipe. +- The named pipe is created with an explicit DACL + (`ConvertStringSecurityDescriptorToSecurityDescriptorW`) that grants + full control only to the creator-owner (the current user) and + `SYSTEM`, cutting off `Administrators` and `Everyone` who would + otherwise have default read/write access (`sshenc-agent/src/server.rs` + `SecurityDescriptor`). - The CLI surfaces an actionable error when the pipe is in use. **Residual risk**: -- The named pipe is currently created with the default security - descriptor. A best-practice hardening is an explicit DACL that grants - only the owner user and `SYSTEM`; that work is not yet in place. - An attacker with admin rights can always create the pipe first; admin rights on Windows already implies full control over the TPM. @@ -263,20 +266,31 @@ fields. the hardware's enforcement — Touch ID / Windows Hello still fires on sign regardless of what the metadata file claims. - Metadata files are written 0600 via `atomic_write`. +- On the Linux keyring / software backend, `.meta` now has an HMAC + sidecar `