Nerd Sniped by BINFMT_MISC
blog.jessfraz.com
blog.jessfraz.com
Can you imagine a future where you don't have to install runtimes to run things anymore because they are all distributed with everything you need? It would be amazing and magical in many ways. No more reinstalling the OS because things got weird after X went berserk.
Being forced to pollute my perfect, pristine machines with multiple versions of Python, or having to even commit to a single version of anything seems less good than not having to.
I'd rather burn the extra HDD space to avoid risky installs messing up the system.
Of course three copies of the binary is not ideal, but it shouldn't even be necessary. With some deep hacking the platform-specific code could be minimized and the rest of the binary could be shared. Wouldn't it be fun to have truly platform-independent binary executables?
[1] https://gist.github.com/jdarpinian/6860ddfd92b5b458a20ab6055...
What about packaging - e.g. this file having a proper icon on Windows? What about distribution via the app market platforms?
How do I go about upgrading the application?
i.e.
assoc
assoc .vbs=txtfile
assoc .mp4=WMP11.AssocFile.MP4
Perhaps it may be worth considering security practices for BINFMT_MISC before people find any sub-optimal defaults. In the past, clever people would exploit some of the default associations that applications would insert on Windows desktops. At some point, desktop file exploring apps may decide to hide "known extensions. The desktop will also leverage this association.I also believe that xdg-open (and the XDG scheme) is more similar to Windows' file associations than binfmt_misc, since XDG is more of a user-facing thing.
I'm not a fan of systemd in the slightest, but blaming systemd for an in-kernel facility that has existed since the mid-90s (and isn't even used by systemd to my knowledge) doesn't make any sense.
[1]: https://elixir.bootlin.com/linux/v4.15.7/source/fs/binfmt_mi...
///bin/true; exec /usr/bin/env go run "$0" "$@"
See https://stackoverflow.com/a/30082862/334761 for detailed explanation what's going on there. The only downside is that all exit codes != 0 get mapped to exit code 1 by `go run`. It will show the original exit code on stderr instead.Compared to that, the example snipped you provided is doing many more, and different things:
1. Launches a shell language interpreter: usually the system default POSIX-compliant sh, but could (rarely) be something else. Compared to "read the first line, and if it's a shebang launch python or whatever" in the kernel, this is massively complicated: it starts another whole runtime. Run "strace" on a file that just does "///bin/true; sleep 1000" to see exactly how much is happening just for that shell launch.
1. Executes /bin/true. It's probably present everywhere, and probably the right program, but still an assumption.
2. Evaluates a bunch of string slinging statements in the shell to interpolate arguments, then replaces itself via "exec".
3. Launches /usr/bin/env (hopefully the right program, and hopefully in the right place) to find the go interpreter.
4. env (hopefully) also calls "exec" again and then launches the go run command to start the compilation/execution sequence.
That's a lot of stuff. Pretty garden-variety stuff, but still a lot of additional complexity. A shebang adds none of it, though "trampolining" shebangs (which themselves are just programs to do basically this) can reintroduce some internally.
That's the beauty of the shebang as a trick for truly interpreted languages: it's extremely direct and simple as a means of getting your code executing on your desired runtime.
...
>Imagine if an entire OS had all the languages packaged this way so that everything could be “dot slashed” and executed but without actually installing the language to your host operating system.
This has been technically possible for decades, but the disadvantages (startup time, memory use, disk use) outweigh the advantages. (better security, assuming no VM escape bugs, which is an assumption you absolutely can't make, considering the long list of Xen CVEs) Breezily asserting the superiority of this solution without acknowledging any possible downsides is also strange... more press release than blog post.
Also, this is a write-up about something cool that author discovered. It’s about the fact that dot slash isn’t magic, but rather a feature which can be (ab)used to do something out of the ordinary. Sounds like a blog post to me.
https://nvd.nist.gov/vuln/search/results?adv_search=false&fo...
https://nvd.nist.gov/vuln/search/results?adv_search=false&fo...
Of the vulnerabilities you've listed (while searching "docker") only four were actually runc vulnerabilities, and most required you to be running root inside the container (or required you to have some form of privileged access on the host). Also, runc doesn't use chroot -- we use pivot_root.
You've also just done a full-text search for "docker" and several of the CVEs just have the word and are not actually vulnerabilities in "docker" nor runc. I don't understand what this is meant to show.
In particular, these are the only vulnerabilities in that list that are arguably related to your point.
* CVE-2017-16539 -- a default configuration error allowing a DoS if you're root in a non-user-namespaced container. The PoC in TFA uses user namespaces and thus this attack is pointless. Not to mention you shouldn't run as root anyway, please stop doing that.
* CVE-2016-9962 -- a partial container escape if you have another process joining the container, there were also several kernel bugs found as well as a result. Also requires root, and user namespaces had a fix for this in the next kernel version. Again, stop running stuff as root.
* CVE-2015-3627 -- an information disclosure that requires a malicious rootfs (so you have to have host-side coordination to set up the rootfs before the container starts), and was never present in "runc" just the library that predated it.
* CVE-2015-3629 -- a partial container escape that required significant host-side coordination (you have to change the configuration of the container to be malicious). Also wasn't present in "runc" just the library that predated it.
So, there has only ever been one plausible container breakout in runc to-date and it was CVE-2016-9962 (and it still required using bad practices). You could argue that CVE-2016-3697 was also a runc bug, but that code was only used by Docker at the time (more of a library bug than a container breakout bug). CVE-2015-3629 requires you to effectively create the container that you're going to break out of, so not viable from a "bad code in a container" perspective.
I'm not excusing these bugs, but they should be put in context. CVEs have CVSS scores for a reason -- they are not all created equal and you need to look at each one individually before coming to conclusions.
I do respect the folks who work on Xen, don't get me wrong, but I don't understand this argument for the security of Xen. If I only consider the 11-year-old floppy privilege escalation[1], then runc is already on better footing in terms of "which project had a worse example of a vulnerability resulting in containment escape". Whether this is due to the young age of containers on Linux, or because containers levarage many different security features, I'm not sure.
Source: I'm a maintainer of runc, and I found CVE-2016-9962.
Suppose that would admit not knowing something... certainly not something we should be encouraging!