Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Posted Aug 14, 2019 19:19 UTC (Wed) by clugstj (subscriber, #4020)Parent article: Hardening the "file" utility for Debian
Posted Aug 14, 2019 19:23 UTC (Wed)
by josh (subscriber, #17465)
[Link] (2 responses)
Posted Aug 14, 2019 21:40 UTC (Wed)
by clugstj (subscriber, #4020)
[Link]
Posted Aug 15, 2019 11:31 UTC (Thu)
by pbonzini (subscriber, #60935)
[Link]
Posted Aug 14, 2019 19:30 UTC (Wed)
by juliank (guest, #45896)
[Link] (8 responses)
Posted Aug 14, 2019 19:53 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link]
Posted Aug 14, 2019 20:09 UTC (Wed)
by epa (subscriber, #39769)
[Link] (6 responses)
Posted Aug 14, 2019 20:26 UTC (Wed)
by juliank (guest, #45896)
[Link] (5 responses)
Posted Aug 14, 2019 23:14 UTC (Wed)
by roc (subscriber, #30627)
[Link] (2 responses)
You can argue it still wouldn't be "safe" for some meaning of the word, but seccomp filters aren't "safe" in those terms either.
Having said that, extra layers of protection are still good and grappling with the issues in this post is still important. In particular, if `file` was written in Rust but users' systems inject C code into it via LD_PRELOAD, then savvy attackers would target that C code. Witness the security vulnerabilities introduced by AV filters over the years.
Posted Aug 18, 2019 3:02 UTC (Sun)
by k8to (guest, #15413)
[Link] (1 responses)
Posted Aug 18, 2019 5:59 UTC (Sun)
by dvdeug (guest, #10998)
[Link]
Posted Aug 15, 2019 13:01 UTC (Thu)
by epa (subscriber, #39769)
[Link]
While there are bugs in the Java or .NET runtimes, or other language runtimes, getting an exploit through one of those is usually much harder than the swarm of exploits a C program will contain unless written with exceptional discipline by a highly skilled programmer.
But actually I wasn't really suggesting one of these heavyweight managed languages that pulls along a runtime environment. Rust doesn't have a runtime, for example. The Cyclone programming language is a safer dialect of C which also doesn't have any special run time requirements.
Posted Aug 17, 2019 11:21 UTC (Sat)
by dvdeug (guest, #10998)
[Link]
Posted Aug 14, 2019 20:05 UTC (Wed)
by Deleted user 129183 (guest, #129183)
[Link] (7 responses)
Well, I guess that’s exactly the reason that openBSD has their own, seemingly NIH, implementation of it…
Posted Aug 14, 2019 22:55 UTC (Wed)
by wahern (subscriber, #37304)
[Link] (6 responses)
The original contributors of seccomp were quite familiar with systrace. seccomp only permits filtering scalars because it was through systrace that it was proven how easy it was to bypass string path filtering unless the kernel copied the string. (Later releases of systrace came with a huge warning that string path filtering wasn't secure.) As I recall, seccomp was originally intended for sandboxing Chrome NaCl, which by design only required read and write from the sandboxed process. seccomp was the minimal amount necessary to put into the kernel to make NaCl work. I don't think Google ever intended seccomp to grow into a general purpose syscall filtering or sandboxing mechanism as it was already obvious from the history of systrace that the low-level semantics don't lend themselves to more sophisticated use cases.
So, no, pledge isn't NIH. seccomp is basically a *worse* systrace, and everybody knew systrace was a dead end.
Another alternative is Capsicum. OpenBSD rejected this for the same reasons the file(1) maintainer hasn't yet refactored their codebase: Capsicum, like the original seccomp, is premised on using a multi-process privilege separation model, which requires alot of work, *especially* for preexisting codebases. Capsicum is great model, but it doesn't prove a viable solution for preexisting code.
Posted Aug 14, 2019 23:46 UTC (Wed)
by roc (subscriber, #30627)
[Link] (3 responses)
It's very important to keep in mind that implementing a sandbox with just seccomp is usually a terrible idea. In Linux, kernel namespaces are the best way to construct a sandbox. Then you apply a seccomp filter as an extra layer of defense, to reduce the kernel API attack surface exposed to sandboxed code. This is what Chrome and Firefox do. OpenBSD of course doesn't have kernel namespaces. Comparing pledge() to seccomp-bpf for constructing sandboxes is really a mistake, you should compare pledge() to kernel namespaces (with or without an additional seccomp-bpf layer).
> I don't think Google ever intended seccomp to grow into a general purpose syscall filtering or sandboxing mechanism
Perhaps Andrea Arcangeli didn't, but Google certainly did, otherwise their decision to use BPF to express arbitrary predicates is unfathomable.
Personally I'm pretty glad they did. We use seccomp-bpf for selective syscall interception in rr in a way that a dedicated sandbox API like pledge() would never have supported. That feature is critical for low overhead in rr recording.
Dead-end or not, seccomp-bpf is working in practice for Firefox, Chrome, rr, and others.
Posted Aug 15, 2019 0:34 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link] (2 responses)
Posted Aug 15, 2019 1:52 UTC (Thu)
by roc (subscriber, #30627)
[Link] (1 responses)
Posted Aug 15, 2019 2:29 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Aug 15, 2019 14:41 UTC (Thu)
by Deleted user 129183 (guest, #129183)
[Link] (1 responses)
I was talking about openBSD reimplementation of `file`, not about `pledge`.
Posted Aug 16, 2019 0:52 UTC (Fri)
by flussence (guest, #85566)
[Link]
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
They do have unveil()-based file "namespaces".
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian
Hardening the "file" utility for Debian