LIVE cartercole.net --:--:-- UTC

// 04 RESTRICTED

cartos

RUST PTRACE MACH ACCESS RESTRICTED

A syscall-interception sandbox in Rust. It spawns a program paused, traps each system call, and per call allows it, denies it with an error, or rewrites its arguments before letting it run. The demo policy makes one file vanish with ENOENT, swaps /etc/hostname for a fake, redirects connections to one public DNS resolver to another, and blocks mkdir. Three crates: an abstract core of syscalls, actions and a SandboxEngine trait, the platform engines, and a CLI that logs what it traps.

Stated honestly

The Linux engine does the real work: ptrace on x86-64 and ARM64, following forks, vforks and clones. A denial cancels the call on entry and injects the error on exit; a rewrite writes the new path or IPv4 address over the old one in the process's memory, in place and with no check that it fits. A Dockerfile builds it so a Mac can exercise it through a shell pipeline. The macOS engine reads a stopped thread's registers through Mach calls but ignores the action it is given, so on a Mac it can only watch, and how much it catches was still being worked out. Two days of work in March 2026, not in git.