Skip to content

feat(sandbox): drop root privileges after initialization on FreeBSD#458

Merged
domcyrus merged 3 commits into
mainfrom
freebsd-uid-drop
Jul 9, 2026
Merged

feat(sandbox): drop root privileges after initialization on FreeBSD#458
domcyrus merged 3 commits into
mainfrom
freebsd-uid-drop

Conversation

@domcyrus

@domcyrus domcyrus commented Jul 8, 2026

Copy link
Copy Markdown
Owner

FreeBSD counterpart of #456 and #457. FreeBSD has no sandbox yet (Capsicum is planned), so under sudo a DPI compromise ran as unconstrained root for the whole process lifetime; this drop is the primary containment in the meantime.

After the BPF capture devices are open, the process drops to SUDO_UID/SUDO_GID (or nobody for plain root; doas does not set SUDO_UID) via setgroups + setresgid + setresuid, verified. Pre-created export files are chowned to the target user so PCAP/JSONL reopens keep working. Opt out with --no-uid-drop.

Trade-off (documented in SECURITY.md): sockstat-based process attribution then only sees the target user's processes.

@domcyrus domcyrus marked this pull request as ready for review July 9, 2026 12:58
@domcyrus domcyrus force-pushed the freebsd-uid-drop branch from ca62e85 to 4278100 Compare July 9, 2026 12:58
@domcyrus domcyrus merged commit 78cc836 into main Jul 9, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant