Executive summary
ephrun packages a Linux ELF executable as an encrypted artifact, obtains a decryption key at runtime, decrypts into a memory file, and executes it without writing the plaintext binary back to disk. Keys can come from a passphrase-wrapped capsule, a Linux kernel keyring entry, or a protected file. Companion tools push short-lived keys over SSH or an authenticated sealed UDP exchange. The project is designed to protect artifacts at rest and raise the extraction cost on a host; it explicitly does not protect a running process from root, the kernel, debuggers, or runtime memory inspection.
Problem and context
Some deployments need an executable present on a machine but prefer not to leave the unpacked artifact on persistent storage. ephrun separates artifact encryption at build time from key availability at runtime and explores several operational key-delivery shapes.
What was built
- Key generation and sealed-box encryption for ELF artifacts.
- KCAP3 passphrase-wrapped capsules with Argon2id parameters in a versioned
- A Linux runtime loader using
memfdandfexecve. - Four key-source modes: capsule, keyring ID, keyring label, and protected file.
- SSH and ephemeral UDP key-push tools with keyring timeouts.
- Threat-model, format, acceptance, operating, and decision documents.
header and read compatibility for earlier capsule versions.
How it works
The trusted build side generates an X25519 key pair and encrypts the executable for its public key. The target obtains the corresponding private material from one of the configured sources. elfdec-run decrypts into a memory-backed file, scrubs the key-source environment it controls, and executes that file descriptor.
Capsules add a passphrase-derived authenticated-encryption layer around the private key. Kernel-keyring modes can make raw key material time-limited and avoid a target-disk key file.
Evidence and validation
The acceptance criteria cover the KCAP3 wire format, derivation parameters, round trips, reference vectors, earlier-version read compatibility, and build integration. The repository also checks threat-model invariants and documents a kernel matrix for the execution path. Test binaries and fixed artifacts make the pack, source, decrypt, and execute chain reproducible.
Boundaries
This is not digital-rights management. A hostile root user, compromised kernel, ptrace-capable observer, loader compromise, or runtime memory instrumentation can recover or alter a running workload. Dynamically linked deployment adds a pre-main loader surface; static builds are the documented hardening path, not a guarantee against a hostile kernel.
Repository map and first run
make
bash test.sh
./ephrun/genkey
Use HOWTO.md for the shortest supported pipeline, SPEC.md for the ELFENC and KCAP formats, SECURITY.md for provided and non-provided properties, and tests/KERNEL_MATRIX_REPORT.md for the recorded Linux behavior.