News for hackers. Stuff that matters.
Re:Flatpak: A security nightmare – two years later by haolez on Friday October 02, 2020 @09:51AM (#24662572)
Except that with "old school" package managers you get security updates without the application or the developer having to act on it. I don't know if it's "a nightmare", but it's worse security comparing against the previous solution.
Re:Flatpak: A security nightmare – two years later by danShumway on Friday October 02, 2020 @10:05AM (#24662715)
Nobody should be relying on dynamic linking as the primary way they keep their home computer secure. Enough applications statically link their libraries that this is not a reliable strategy.

If you can't trust a library author to keep their code up to date, it's probably also a mistake to trust them to use your system libraries in a way that minimizes their attack surface.

I also have problems with Flatpak's security model, particularly with their UX around permissions. We already learned from Android/iOS that allowing highly permissive manifests out of the box was a bad idea. But at least Flatpak is trying to do something, and that something seems like a tangible improvement to me. The idea that our systems will be secure because we dynamically link everything needs to die; it's not a viable security model.

Even if the only thing that Flatpak does is kill the "dynamic libraries make me secure" perspective, that on its own will be worthwhile.

Re:Flatpak: A security nightmare – two years later by haolez on Friday October 02, 2020 @11:10AM (#24663435)
Distribution packagers often remove statically linked libraries from upstream and make the software dynamically link anyway.

I'm not saying that the UX of native packages is great for end users. I'm just saying that the security model is saner.

Re:Flatpak: A security nightmare – two years later by danShumway on Friday October 02, 2020 @02:30PM (#24665527)
That cat is already out of the bag. How many Ubuntu users have custom software sources enabled; how many of them are installing games from Humble Bundle that come as their own `deb` packages with statically linked assets? GoG installed Linux games don't even use the package manager at all.

Heck, there's a decent amount of Linux software being distributed right now as `tar.gz` files with an install script that just extracts the folder someplace and then modifies the user's path.

Flatpak improves on all of that.

It's one thing to look at the Linux security model and say that OSS authors should coordinate with distros, but OSS authors and general Linux developers already don't do that today. So how is Flatpak making that situation any worse?

Developers were already abandoning the sane security model. Flatpak is a response to that trend, not the cause of it.

Re:Flatpak: A security nightmare – two years later by cycloptic on Friday October 02, 2020 @03:05PM (#24665949)
>How many Ubuntu users have custom software sources enabled; how many of them are installing games from Humble Bundle that come as their own `deb` packages with statically linked assets?

I don't have an answer to this question, but I would never do this. If the game was open source, I would rebuild it to be dynamically linked, and then publish the dynamically linked package.

Re:Flatpak: A security nightmare – two years later by danShumway on Friday October 02, 2020 @03:30PM (#24666228)
If this is genuinely your philosophy then Flatpak isn't a real problem for you because you can take any OS application that's bundled with Flatpak, rebuild it to be dynamically linked, and then publish the new package using whatever package manager you prefer.
Re:Flatpak: A security nightmare – two years later by cycloptic on Friday October 02, 2020 @04:14PM (#24666596)
Or, alternatively, create a new flatpak runtime and rebuild it for that.
Re:Flatpak: A security nightmare – two years later by kevincox on Friday October 02, 2020 @11:22AM (#24663552)
The distribution can recompile dependent packages if required without requiring the upstream program to release a new version no matter how the libraries are linked.
Re:Flatpak: A security nightmare – two years later by danShumway on Friday October 02, 2020 @12:04PM (#24663999)
In which case, the problem isn't Flatpak, it's packages that are distributed outside of the distro's control. If Ubuntu was the ultimate distributor of every Flatpak on their system, they could also recompile and update the dependencies for those Flatpaks whenever a security risk was discovered.

Should we get rid of the AUR while we're killing Flatpak?

Re:Flatpak: A security nightmare – two years later by remram on Friday October 02, 2020 @12:54PM (#24664534)
If applications are distributed by the same people, at the same frequency, linked against the same versions of the dependencies, why have two distribution mechanisms at all? What you're describing sounds like it could be a separate APT channel ("backports", "non-free", "edge", hell call it "flatpak" if you want) but doesn't need another package manager and package format.
Re:Flatpak: A security nightmare – two years later by danShumway on Friday October 02, 2020 @02:12PM (#24665329)
That's what I was getting at -- the defense that package managers handle everything in the existing system falls apart as soon as you start compiling packages from source, adding custom repos, or installing proprietary packages, many of which will statically link their dependencies or use custom versions of libraries. There's nothing a distro maintainer can do about them.

The "authors won't keep their own software up to date" point isn't an argument against Flatpak in specific, it's an argument against custom package sources in general.

If we really don't trust authors to update their own software, then we ought to be pushing for even stricter sandboxing and system isolation than what Flatpak currently provides. The cat is already out of the bag: people already run software on their system from the AUR, from private repos, from custom Linux installers that just bundle everything into a tar.gzip. Dynamic linking won't save you from them.

Re:Flatpak: A security nightmare – two years later by boomlinde on Friday October 02, 2020 @05:05PM (#24667016)
> If Ubuntu was the ultimate distributor of every Flatpak on their system, they could also recompile and update the dependencies for those Flatpaks whenever a security risk was discovered.

If Ubuntu was the ultimate distributor of every Flatpak and had the means to recompile and update the dependencies for those Flatpaks whenever a security risk was discovered, they wouldn't need Flatpak. They could just maintain the software the way they've always done before.

Consider what the advantages to Flatpak really are.

1. Anyone can publish them (low standard of inclusion, which I hope isn't Ubuntu's goal)

2. You can easily distribute closed-source software with the exact dependencies they were compiled for (which Ubuntu can't change unless they have access to the source code and its maintainers are willing to provide that charity to closed source software shops)

3. You can easily install the software on any system with a recent enough kernel (Ubuntu being the sole provider wouldn't change that)

Re:Flatpak: A security nightmare – two years later by danShumway on Friday October 02, 2020 @07:37PM (#24668137)
It's not as robust as it could be, but Flatpak pretty objectively has better sandboxing than a .deb package once you get rid of the dynamic linking problem. That's a good thing, because not all security bugs come from dependency management. But, ignore the sandboxing aspect for a second:

1. Ease of distribution of software should be a goal on Linux if it's not already. The lack of ease of distribution of software contributes to decreased support from developers on other OSes, increased pressure and stress for distro maintainers, and some truly awful installation methods outside of the official package managers.

2. Proprietary software largely already does this, so granted, using Flatpak doesn't really change anything. But that's also kind of the point; proprietary software already ignores the software center, so adding better sandboxing to those apps is a really good idea.

3. There are reasons to want the ability to link against multiple versions of the same dependency even if you're getting all of your software compiled by a single source upstream. Reconciling dependencies if you're a distro maintainer is hard. Being able to quickly update any app that's using an outdated dependency without worrying that you're going to break another app is kind of nice.

I'm not saying that Flatpaks should be centrally managed. My point was that people are already distributing software outside of app stores. We already have the AUR, we already have `tar.gz` files (even from Open Source projects), we already have custom repos that might break/rename/embed old dependencies.

Flatpak is responding to a trend that already exists; trying to make it slightly better so that instead of a random install script somebody pulls off Github to curl dependencies, they get a well-defined package that's less likely to bork their system or introduce a security hole into their other applications.

And that's good. We want to live in a world where people can install software from any source -- we wouldn't use Linux otherwise. But any system where people can install software from any source is going to have the same issues with dependency management and with trusting the author to keep their app up-to-date. All of the problems people are throwing at Flatpak in that specific area are just criticisms of the fact that Flatpak isn't centrally controlled. They're not really criticisms of the technology itself.

Re:Flatpak: A security nightmare – two years later by hapless on Saturday October 03, 2020 @12:40PM (#24673124)
Those problems were brought up as objections the very minute that Flatpak and Snappy arrived.

OP has just provided concrete examples of those problems appearing in the real, existing public repos for Flatpak.

This is not surprising.

It has turned out exactly as expected: Upstream developers cannot be trusted to update dependencies on a timely basis.

Re:Flatpak: A security nightmare – two years later by danShumway on Saturday October 03, 2020 @10:09PM (#24676094)
> Upstream developers cannot be trusted to update dependencies on a timely basis.

And the current system, even without Flatpak, doesn't force them to. You're not arguing against Flatpak, you're arguing against decentralized app distribution in general.

You are already living in a world where upstream developers can decide to distribute their software using channels that distro maintainers can't control, update, or patch.

Flatpak changes nothing about that arrangement, it merely acknowledges that the problem exists and tries to make it slightly better. The alternative to Flatpak for a lot of Open Source devs isn't an official Debian package, it's a tar.gz file, which is just objectively worse.

Re:Flatpak: A security nightmare – two years later by hapless on Friday October 02, 2020 @10:18AM (#24662845)
Static linking is dead. Most applications cannot be built statically, at all.

Solaris-style RPath is still an option on Linux, but it is rarely used.

As far as “security,” dynamic linking is not an attempt to contain applications, but rather to fix as many things as possible with as few updates as possible.

Flatpak actively encourages upstream developers not to participate in the wider picture, and as it turns out, upstream developers can’t be trusted to fix security holes in a timely manner.

This was a widely foreseen issue that was pooh-poohed in the early days of flatpak, but, well, look how it turned out.

Re:Flatpak: A security nightmare – two years later by remram on Friday October 02, 2020 @12:56PM (#24664552)
A lot of languages like Rust and Go (but also C++) mostly do static linking.
Re:Flatpak: A security nightmare – two years later by hapless on Saturday October 03, 2020 @12:35PM (#24673084)
Golang doesn't really support static binaries. This may be confusing, since it compiles-in all golang dependencies, but by default, all output is dynamic, and it's quite difficult to get static binaries out of it at all.

The golang model expects all golang deps to be distributed as source code, and then it expects to dynamically link to all C dependencies. It is technically possible to diverge from the latter set of expectations, but it is not easily or commonly done.

C++ is much like golang in that respect. Template libraries are always "static" in the sense that they are distributed only as source code, but the final binary output is almost always a dynamically linked binary.

Re:Flatpak: A security nightmare – two years later by otterley on Friday October 02, 2020 @10:40AM (#24663074)
> Most applications cannot be built statically, at all.

That’s a pretty bold claim. Can you identify a specific C program that cannot be built statically, no matter how hard you try?

Re:Flatpak: A security nightmare – two years later by cycloptic on Friday October 02, 2020 @11:14AM (#24663470)
GTK does not support static linking, so that rules out pretty much all GTK applications: https://mail.gnome.org/archives/gtk-list/2018-January/msg000...

The question about it comes up every so often, but nobody has ever put up the effort to maintain it. It appears to be a lot of work for very little gain.

Re:Flatpak: A security nightmare – two years later by marcthe12 on Friday October 02, 2020 @11:06AM (#24663391)
Certain libs use dlopen() which needs dynamic linking. Mesa, Pam, Qt (static is possible but a lot of stuff will break), Glibc(static is possible but nsswitch.conf will break), Alsa. So most graphical apps will fail to be pure static(Prob possible but will hardware/config specific). So we need to tackle and provide alternatives to dlopen.
Re:Flatpak: A security nightmare – two years later by rleigh on Friday October 02, 2020 @11:40AM (#24663744)
Running NSS and PAM modules in-process was IMO a historical mistake. Convenient in one aspect, rather inconvenient and impractical in many others.

If we were to redo these today, I think we'd do them out-of-process and talk to them over UNIX domain sockets or pipes.

The transitive dependencies of NSS and PAM modules can also wreak havoc with your application. There are many bugs which have arisen because of these limitations. Yes, looking at you, GnuTLS.

Re:Flatpak: A security nightmare – two years later by wahern on Friday October 02, 2020 @04:02PM (#24666494)
OpenBSD chose BSD Auth over PAM for this reason. With BSD Auth the C API invokes binaries in /usr/lib/auth which are SUID or SGID according to which permissions are required for the credential store.
Re:Flatpak: A security nightmare – two years later by jcelerier on Friday October 02, 2020 @01:23PM (#24664844)
> Qt (static is possible but a lot of stuff will break),

as a user of statically-built Qt I haven't noticed any particular breakage

Re:Flatpak: A security nightmare – two years later by gray_-_wolf on Friday October 02, 2020 @10:57AM (#24663301)
> identify a specific C program

Well, not sure about C (but I assume something using gtk could be pain), but if we expand that to C++, I mean, I would expect firefox and chrome to be basically unbuildable in static manner.

> no matter how hard you try

Well, no. If you are willing to rewrite it (even significant changes), of course it will be possible to built it statically. That does not mean it is doable in practice.

Re:Flatpak: A security nightmare – two years later by franga2000 on Friday October 02, 2020 @11:04AM (#24663374)
I doubt they meant "no matter how hard you try" nor were limiting this to C programs only. Something the size of Firefox, for example, with hundreds of files, multiple languages and dozens of platform variations, is simply not designed for a fully static build and trying to modify it to build like that would be an absurd amount of work for basically no reason, so it hasn't been done and probably never will be.

Add licensing complications to that (Qt is notorious for this) and OP's statement is for all intents and purposes true.

Re:Flatpak: A security nightmare – two years later by otterley on Friday October 02, 2020 @12:59PM (#24664590)
Perhaps so, but Firefox is but one program among the hundreds or thousands that are available in a typical Linux distribution. "Most" implies a quantitative analysis (i.e., more than half), which I think is disputable.
Re:Flatpak: A security nightmare – two years later by hapless on Saturday October 03, 2020 @12:32PM (#24673064)
Firefox has a hard dependency on GTK, so it is literally unbuildable as a static binary.
Re:Flatpak: A security nightmare – two years later by hapless on Saturday October 03, 2020 @12:44PM (#24673153)
Firefox. Chromium. KDE. Gnome-shell. Libreoffice.

Static linking is an atavism. Application authors don't spend time thinking about it any more.

The main reason static linking persisted as A Thing into the 1990s was that fossilized vendor UNIXes didn't support it, or didn't support it well. Those systems are all extinct.

About the only place you still see static linking is embedded. And that is its own world.

Re:Flatpak: A security nightmare – two years later by jart on Friday October 02, 2020 @10:54AM (#24663258)
The two weaknesses cited by the OP to support your argument were CVE-2019-17498 and CVE-2020-12284. That means if you use the RedHat's App Store to illegally torrent media content and pentest strange ssh servers, you might get pwnd. Tears are flowing to mine eyes.
Re:Flatpak: A security nightmare – two years later by 013a on Friday October 02, 2020 @10:27AM (#24662944)
I think the industry has moved past believing that dynamic linking has a net security and usability benefit over static linking/sandboxing, even if you heavily bias toward preferring security. The three most "modern" and popular linux "package managers" made in the last decade (Snap, Flatpak, Docker) all bias toward static linking and sandboxing (in the case of docker, forced sandboxing, but the others are opt-in).

Sidenote: I include docker as a package manager in that list because recently I actually ran into a very large and popular command line application that, per their documentation, prefers distribution and execution via docker over anything else: aws-cli. They don't keep any other linux package managers up to date, despite having a package in snap and distributing a .tar.gz. They recommend invoking it via docker. Rather interesting, and I'm surprised we haven't seen a frontend for "docker as a pm" gain traction, to increase usability over "go into your .bashrc and alias aws=docker run aws/aws-cli:latest $*"

Re:Flatpak: A security nightmare – two years later by sempron64 on Friday October 02, 2020 @10:48AM (#24663166)
I think the industry has "moved past this" because for SaaS platforms, it takes a lot less labor to enforce sandboxing in-house applications on the cloud than to maintain dependencies across the shop. However, for an OS distribution to end users devices, where applications inevitably ask for an are granted MUCH more permissions than they need, this is not a safe model. It is CLEARLY superior for users and for operating system maintainers, or others responsible for user security, to update dependencies using the traditional dynamically linked model. No work needs to be done to consider the compilation tooling of each individual application.

The existence of Flatpak etc. is a misguided concession from the FOSS community to private businesses and to software developers who are used to packaging for the cloud. The model is not appropriate for desktop or mobile software -- there is a reason that filesystem access is extremely restricted or impossible on mobile platforms, and that even Android has moved to dynamically prompting for permissions when apps use them rather than bundling them into a single prompt at installation.

For Flatpak to work, we need MUCH heavier sandboxing, which will be detriment to productivity for desktop users for certain classes of applications, and may prevent many types of applications from being packageable as Flatpak. I think this is a fine compromise. I'm OK with installing Spotify as a Flatpak (given better security, not now) but keeping my webserver, database, file manager, terminal, programming language, and other "system" software in the OS repository.

Re:Flatpak: A security nightmare – two years later by hapless on Saturday October 03, 2020 @12:47PM (#24673170)
Snap, Flatpack, and Docker applications almost universally use dynamic linking.

They just use some combination of rpath fields and virtual filesystems to make sure the dynamic linker only inspects the paths mandated by the application author.

Re:Flatpak: A security nightmare – two years later by hedora on Friday October 02, 2020 @11:28AM (#24663606)
Docker dynamically links; you don’t need to recompile the world to update a docker image. You just regenerate the docker image.
Re:Flatpak: A security nightmare – two years later by 013a on Friday October 02, 2020 @11:34AM (#24663684)
It can dynamically link within the container, but as far as I know the container as a whole does not dynamically link with the outside world. Its effectively a chroot with a full system image inside that root filesystem.

And that's what we're talking about, effectively; how self-contained and sandboxed the package itself is.