Commit d633a18
Expand harden_process: PR_SET_DUMPABLE=0, PR_SET_NO_NEW_PRIVS=1 on Linux (#61)
harden_process previously only called setrlimit(RLIMIT_CORE, 0). Two
low-cost Linux additions close meaningful attack surface:
- PR_SET_DUMPABLE=0: makes /proc/<pid>/mem readable only by root,
not the same UID, and denies ptrace attach to non-root peers. The
same-UID attacker who was the biggest residual threat against
decrypted plaintext in process memory now loses their
ptrace / /proc/mem handle.
- PR_SET_NO_NEW_PRIVS=1: an exec*() after this point can't inherit
setuid or file-capabilities privileges. The enclave apps never
setuid, and the wrapped child processes they spawn (npm, git,
awscli) don't benefit from it either — so this is free.
Both are done via direct libc::prctl calls under #[allow(unsafe_code)]
with tracing::warn!-on-failure semantics matching the existing
setrlimit path. Linux-only (cfg(target_os = "linux")) — the prctl
calls don't exist elsewhere.
Still not applied: RLIMIT_AS, seccomp-bpf, macOS PT_DENY_ATTACH,
Windows SetProcessMitigationPolicy. Threat-model section rewritten
to describe the new posture and the remaining gaps.
Co-authored-by: Jay Gowdy <jay@gowdy.me>1 parent c935a50 commit d633a18
2 files changed
Lines changed: 58 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | | - | |
9 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
14 | 26 | | |
15 | 27 | | |
16 | 28 | | |
| |||
39 | 51 | | |
40 | 52 | | |
41 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
42 | 90 | | |
43 | 91 | | |
44 | 92 | | |
| |||
0 commit comments