omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / evidence / SECURITY-673 / pure2 / REPORT.md
| 1 | # Strict pinned-executable launch profile for Omega #670 |
| 2 | |
| 3 | Date: 2026-10-23. Parent tracker: #673. Branch: `fix/security673-qualified`. |
| 4 | Base: `9a2b6a5` plus the `execpure` change in this commit. Platform: Linux AArch64, native execution. |
| 5 | |
| 6 | ## Threat and protected assets |
| 7 | |
| 8 | A launcher admits a native executable after a caller supplies only a path and argument vector. The |
| 9 | untrusted program may try to read or write inherited descriptors, open files outside its pinned |
| 10 | image, create sockets, fork, execute a different image, allocate unbounded memory, or run without a |
| 11 | time limit. The protected assets are the caller's descriptors and filesystem view, other processes, |
| 12 | and host availability. |
| 13 | |
| 14 | This is a strict, fixed profile for one pinned executable. It is not a general sandbox for arbitrary |
| 15 | workloads and it does not add a second authority service. |
| 16 | |
| 17 | ## Enforcing code |
| 18 | |
| 19 | The compiler adds one host word, `execpure` (code 135), lowered by `hpack` in `seed/omc/omc.om`. |
| 20 | After the existing packet validation and descriptor closure, `hpure` performs these operations at |
| 21 | the kernel boundary, in order: |
| 22 | |
| 23 | 1. `openat(AT_FDCWD, path, O_RDONLY|O_CLOEXEC|O_PATH)` pins the image as descriptor 3. |
| 24 | 2. `landlock_create_ruleset` handles execute, read, write, directory, remove, make and refer rights. |
| 25 | 3. `landlock_add_rule` allows only `EXECUTE|READ_FILE` beneath the pinned descriptor. |
| 26 | 4. `prctl(PR_SET_NO_NEW_PRIVS, 1)` then `landlock_restrict_self`. |
| 27 | 5. `prlimit64` sets CPU 1 s (hard 2 s), file size 1 MiB, stack 8 MiB, core 0, processes 0, |
| 28 | descriptors 4 and address space 128 MiB. |
| 29 | 6. `seccomp(SECCOMP_SET_MODE_FILTER)` installs a 27-instruction filter allowing only: |
| 30 | `read` on descriptor 0, `write` on descriptors 1 and 2, `execveat` on descriptor 3 with |
| 31 | `AT_EMPTY_PATH`, and `exit`/`exit_group`. |
| 32 | 7. `execveat(3, "", argv, empty env, AT_EMPTY_PATH)` replaces the process. |
| 33 | |
| 34 | Every failure before `execveat` returns the kernel's negative error; there is no fallback to a |
| 35 | less-restricted launch. The caller cannot select a weaker profile through this word. |
| 36 | |
| 37 | ## Tested properties |
| 38 | |
| 39 | `pure-child.om` is the untrusted consumer. It asserts, in order: |
| 40 | |
| 41 | | Attempt | Expected | |
| 42 | | --- | --- | |
| 43 | | read public stdin | works | |
| 44 | | read descriptor 3 (the pinned image) | EPERM | |
| 45 | | write descriptor 0 | EPERM | |
| 46 | | read descriptor 1 | EPERM | |
| 47 | | `open` private data | EPERM | |
| 48 | | `open` judge data for write/truncate | EPERM | |
| 49 | | create a socket | EPERM | |
| 50 | | fork | EPERM | |
| 51 | | execute a different image | denied | |
| 52 | | write public stdout | works | |
| 53 | |
| 54 | The child exits 0 only if every assertion matches. `pure-raw.om` emits four fixed native images |
| 55 | that attempt `execveat` on an unassigned inode, raw `openat`, raw `getpid` and a 1 GiB `mmap`. |
| 56 | Each expects the exact kernel refusal and exits 0. |
| 57 | |
| 58 | ## Results |
| 59 | |
| 60 | | Case | Observed | |
| 61 | | --- | --- | |
| 62 | | Compiler rebuild `om4 -> stage1 -> stage2` | stage1 == stage2 | |
| 63 | | `pure-launch` with `pure-child` | exit 0; stdout `public-output`; protected files unchanged | |
| 64 | | raw-0 absolute `execveat` | exit 0; kernel `EACCES` | |
| 65 | | raw-1 raw `openat` | exit 0; kernel `EPERM` | |
| 66 | | raw-2 raw `getpid` | exit 0; kernel `EPERM` | |
| 67 | | raw-3 1 GiB `mmap` | exit 0; kernel `EPERM` | |
| 68 | | Gate branch/packet/source | exit 0 | |
| 69 | | Native host suite | exit 0 | |
| 70 | |
| 71 | Raw traces in `launch.strace` and `raw-0..3.strace` show the Landlock ruleset, rlimits, seccomp |
| 72 | filter, pinned `execveat`, and each refusal. `protected-before.sha256` and |
| 73 | `protected-after.sha256` match. |
| 74 | |
| 75 | ## Residual limits |
| 76 | |
| 77 | - Fixed profile only. There is no per-request grant identity, generation, revocation fence, |
| 78 | durable budget or caller-selected policy. Those remain #670/#649/#651 work. |
| 79 | - The pinned image is trusted to be the intended executable. The profile does not establish source |
| 80 | correctness, a diverse compiler or absence of kernel/Landlock/seccomp defects. |
| 81 | - `RLIMIT_CPU` bounds CPU seconds, not wall time, output volume, descendant count or total system |
| 82 | memory. `RLIMIT_NPROC=0` is the current process-control boundary; no process tree or cgroup is |
| 83 | created. |
| 84 | - Landlock ABI support and the exact handled-access set are host assumptions. Unsupported kernels |
| 85 | fail closed at the kernel call; no emulation was used. |
| 86 | - Only synthetic files and native fixtures were used. No device, GPU, network service or private |
| 87 | data was touched. This does not close #670 or #673. |