411 points · by lp001 · 7y ago · 228 comments
1. Over two years ago, this was apparently detected automatically by the syzkaller kernel fuzzer, and automatically reported on its public mailing list. [1]
2. Over a year and a half ago, it was apparently fixed in the upstream kernel. [2]
3. It was apparently never merged back to various "stable" kernels, leading to the recent CVE. [3]
So you might read that and think "Ok, probably a rare mistake"...
...but instead:
4. This is apparently a _super_ common sequence of events, with kernel vulnerabilities getting lost in the shuffle, or otherwise not backported to "stable" kernels for a variety of reasons like the patch no cleanly longer applies.
Dmitry Vyukov (original author of syzkaller fuzzer that found this 2 years ago) gave a very interesting talk on how frequently this happens a couple weeks ago at the Linux Maintainer's Summit, along with some discussion of how to change kernel dev processes to try to dramatically improve things:
slides: https://linuxplumbersconf.org/event/4/contributions/554/atta...
video: https://youtu.be/a2Nv-KJyqPk?t=5239
---
[1] https://twitter.com/dvyukov/status/1180195777680986113
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux...
[3] https://mobile.twitter.com/grsecurity/status/118005953923380...
I'm amazed the GRSecurity people have managed to do it for so long. Even if merging their stuff mainline legitimately wasn't practical, I've seen plenty of snark and dismissiveness from the Linux team towards them and others. And GRSEC does actively bring in CVEs into their kernel patches all the time and get paid via sponsors to do so.
I'm sure going through old CVEs is a great way to find "zero days" and/or relapses after old patches. Or even just following the work GRSec does there's probably plenty of stuff for a highly motivated company like NSO to exploit.
Why even post this, when it has nothing to do the with the case GP & OP described? It's misleading at best.
The failure here is in the way Google has set its Android development process. They keep a separate "stable" kernel, and manually select certain patches to backport to. In process they skip all kinds of patches - performance, features, and yes, security ones. Given that only selected patches are backported, the process is best described as insecure by default. It was Google's decision to favor stable API over security here.
This is compounded by the fact other Android phone vendors are pretty slow at releasing OS upgrade - and tend to stop releasing them altogether shortly after the phone's no longer manufactured.
The mainline kernel, as released by the Linux core team is up to date with security. Hold to account people that decided to skip patches as a matter of course, resulting in the insecure by default process.
To me, the particulars of this exact case are not as interesting as the fact that the entire Linux patching and backporting of security issues seems _very_ fragile, with things frequently getting "lost" for mundane reasons, and a key part of the "why" it is so fragile is due to many of the core Linux development processes.
This particular CVE is apparently one small example that happened to catch some headlines out of _thousands_ of similar problems.
That talk linked above by Dmitry Vyukov is worthwhile for getting a sense of the magnitude of the problem.
Now why that fix never made it in most vendor kernels (besides a few like the one in the Pixel 3 that is based on 4.9) is a good question. But at the same time there is the reality, that everyone focusing on the upstream LTS kernel would have never gotten the fix.
I think it's still the won't layer. Google may be able to put some pressure to change things, but it's describe the issue as "the failure is in the way SOC manufacturers have set their kernel porting process". You often get chips which work with one version and a dump of specific drivers. Beyond pressuring the company to upstream their changes, or writing clean room versions, I don't see many solutions.
But isn't the issue that Android didn't merge it? Linux patched it.
https://www.theverge.com/2016/4/14/11434926/blackberry-encry...
Also AFAIK Blackberry only provided a hardened kernel with a single device in 2015 called Priv. I haven't heard anything from them since... maybe someone could correct me here.
The fact you use the word "prioritize security" is indeed telling. Security is just one aspect of a system. There is no particular reason for Linux to prioritize it above everything else, no matter what twitter infosec drama queens believe.
Obviously the fact that infosec people are quite often insufferable does not help their case.
If I were an average consumer, I would care much more about my device being secure, than having real time audio.
If you're system gets p0wned there is hardly any audio to play.
macOS, iOS and Windows security improvements, while being the musicians choice for real time audio, show it is possible to put security first, while offering a good audio stack.
Linux distributions make up the majority of public web and database servers and approximately none of the real-time audio players, is that not a “particular reason” to prioritise security over real-time audio?
It's bad enough that syzbot finds fifty serious bugs per hour, but I'll relay a personal anecdote. Earlier this year I wagered a colleague that I could open up the source of the 4.10 kernel (the one that was once current in Ubuntu 16) and find an obvious defect in less than an hour. It actually only took me about 15 minutes, to find a deadlock in the squashfs that was triggered by kmalloc failure and an error path via goto, which of course nobody should ever use. And while I'm reading it I'm just thinking to myself that this is the worst program I've ever seen and it would never pass a code review at my workplace, but it's out there right now running on billions of computers.
I hate that people keep peddling this nonsense because they wrote a little C and read a headline about “goto considered harmful”, which is a gross oversimplification and a BAD piece of “wisdom” that for some reason won’t die. This is how serious handling in C is done. Please stop repeating this tired trope.
Oh man, can I put that on a t-shirt?
The other half of the problem is the companies that actually use these garbage dump forks and build products on top of them.
For me, getting the SoCs and chips we use running on latest upstream kernels was a high priority in platform bringup.
I only used SoC vedors' garbage dump SDKs for quick testing & some reference. And chip vendors' drivers I ported straight to upstream git version.
Of course this isn't how it goes in companies where "shit to market" is top priority.
- https://syzkaller.appspot.com/linux-4.14 - https://syzkaller.appspot.com/linux-4.19
As far as I know, no one is doing anything with the syzbot bugs against stable kernels directly, since no company using Linux is paying anyone to do it as their job. But some are getting fixed; e.g., some get reported against mainline too, then fixed and backported.
A weekly report with some easy to understand graphs would probably convince more people to work on these bugs.
The problem is there are so many of those.
This one gets a bug tracker entry.
When Project Zero posts a lengthy analysis with lots of scurious claims about the victims of the exploit, the window of exploitation, and narrative about the poor development practices that led to it, then call it even.
If it follows the traditional pattern, they'll write a post blaming some external party. No, seriously, when people point out all of the "Android" faults they've found invariably it is some variation of "but it isn't really Google's fault....".
Project Zero is brilliant, full of brilliant people, and is a remarkable effort, but when your paycheque is signed off by someone, it is human nature that you're really going to pussyfoot with them.
For now. A comment from the reporter on the bug tracker entry:
>A more detailed explanation of this bug and the methodology to identify it will be written up in a forthcoming blog post when I find the time.
A minor windows exploit is found, and they publish "Windows Exploitation Tricks". An iOS exploit is found and they do a six part "very deep dive into iOS Exploit chains".
Now, they find a bad Android exploit and they don't publish anything.
However, I do think some of the motive is to take a bit of shine off Apple - meaning it's partly a marketing campaign.
Will there be a large analysis how frequently this was exploited and so forth? How about a public Google blog post around this?
Was there a Project Zero blog post before those comments went public that I missed?
[1] https://bugs.chromium.org/p/project-zero/issues/detail?id=19...
Because if this wasn't announced on their blog I'm going to have to say that this particular case would not be an apples to apples comparison.
Here was the Project Zero blog post on Apple's exploit, for comparison.
https://googleprojectzero.blogspot.com/2019/08/a-very-deep-d...
int fd, epfd;
struct epoll_event event = { .events = EPOLLIN };
fd = open("/dev/binder0", O_RDONLY);
epfd = epoll_create(1000);
epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &event);
ioctl(fd, BINDER_THREAD_EXIT, NULL);It's unfortunate that Google chose to use a custom IPC system, binder, for Android, instead of changing Android's design to better fit Linux. If binder was in use outside Android, I expect this bug would have been caught long ago and certainly would have been backported to stable.
I just had a look at binder.c and the ref counting and locking in general looks like a nightmare to maintain. This reminds me of how much I hate resource management in C.
[1] https://developer.sony.com/develop/open-devices/
[2] https://www.xda-developers.com/asus-zenfone-6-custom-rom-twr...
But the general problem isn't whether it is possible for someone to buy an unlocked phone, but rather that it is possible to "buy" a phone and have it turn out to be non-unlockable. The general case is important so that users who run up against manufacturer shenanigans can straightforwardly route around them, and also simply preventing the pileup of more unusable planned obsolescence ewaste.
So many iPhone users knowingly refuse to upgrade to newer versions of the operating system just so they can keep their jailbreak.
People do that all the time with desktop computers.
For programmers and experts no.
But if it was toggle-able, I would toggle "sandbox everything, don't let anything not secure run, only allow trusted apps" in a heartbeat for work machines, my parents, and so on...
You mean a security model that misses the fact that the kernel cannot be updated and relies on a "sanboxing" solution that doesn't bother limiting kernel attack surface. No, I don't think they even had a security model in mind, a threat model or anything beyond random ad hoc ideas. And if they did some thinking, they would not have chosen SELinux either, as it's not a decent solution to anything, it's more like a solution to "we must to do something, this is something, we must do this".
Is there a well-researched theory that considers a "breaking point" in this pattern? Where we either a) accept that all data is at risk of being exposed or b) develop fundamental security patterns to privatize our data or c) something else?
> Due to evidence of in the wild exploit, we are now de-restricting this bug 7 days after reporting to Android.
Why is this a good idea?
It’s also probably not a terribly great assumption that no one else has independently discovered this vulnerability that’s already been independently discovered twice. Caution suggests we should assume this is in the wild and act accordingly.
We don't know, because we don't know who bought it and how widespread they deployed it.
> No longer occurring on linux-next, probably fixed by the following commit:
> #syz fix: ANDROID: binder: remove waitqueue when thread exits.
https://groups.google.com/forum/#!msg/syzkaller-bugs/QyXdgUh...
See for example:
https://mobile.twitter.com/grsecurity/status/118005953923380...
I guess it informs us what not to do at the very least. Given the track record, I'm not very optimistic of the vendors pushing a patch very soon (if ever). This keeps us informed at least.
They can easily give that^ information without exposing details of the bug though?
The recommendation that other browsers are inherently protected doesn’t make sense. Any app with an rce bug could be a vehicle to exploit this Android bug.
Unpopular opinion but this is why I prefer walled garden apple for my family then alternative.
Saying "doesn't have the ability to install apps from other sources" is the same as saying "doesn't give you the choice to install apps from other sources" -- it's removing a choice.
If you don't want to install apps that aren't approved by Apple then... don't. You could choose not to even if your ability to choose was not restricted.
And of course, "untrusted sources" is not the same as "all side-loading". I use sources to sideload from that I trust more than the average app developer.
https://www.pcmag.com/news/363357/google-irks-epic-games-by-...
You can install family link, which blocks that option. It's a good option for parents to keep tabs on their kids - it shows you location, and which apps are installed.
So, you have to sideload an app or from some other source. Is it unreasonable to say don't do that? How common is it anyway? I work with IT folks and only a few ever seem to load outside the Play store. Perhaps in other parts of the world it's more common...?
Similarly, Chrome is only mentioned because it's notable that it can be effective from inside its isolation if combined with a browser exploit. That likely applies to all browsers, but the article recommends to switch browsers.
I'm not sure, but aren't Play Store submittals APKs anyways? Is additionally self-hosting them that much more complicated?
I've heard that developers often go Play Store exclusive, for fear that Google might block them. Is that true?
I get most of my stuff from F-Droid and some software vendors provide APKs straight from their websites and whatever is Play Store exclusive, I simply don't use.
It was going really well, at least until recently, when here in Germany they started introducing mandatory apps for online banking, available (of course) only on Play Store or App Store.
I wouldn't even mind everyone's app-obsession if they'd at least always provide a store-free APK as well.
[1] https://f-droid.org/en/package/com.github.yeriomin.yalpstore...
Since it was a banking app, I got the APK of many different sites/programs and compared the hashes, and one of the programs had definitely tampered with the APK, but I can't remember which.
Since I left Aurora on my phone, they seemed to have passed on untouched APKs, but don't take my word for it.
EDIT: Also, this voids me of any "warranties" my bank would offer me, so I'm really not going down that path. Really, the only correct thing would be for the bank to offer the APK on their site, but I'd probably have to wait until the government forces this to happen (if ever).
Then there's f-Droid, the people that run without Google apps (alternate roms).
And then there's "Android TV" that has a "different" play store due to the TV profile being different - but allows sideloading of apps like zerotier(VPN) or chrome - that work fine on TVs - but unfortunately isn't flagged as supporting TV in the Manifest.
Please, give me instruction to root my Xiaomi Ido until they fixed it! (updates on my phone disabled for a while)
I'm slightly confused: Do they mean any app or a compromised app?
From my reading of this comment[1], it sounds like this vulnerability is such that if an attacker has vulnerability (1), this vulnerability can be used as vulnerability (2) and (3). It sounds like NSO group either had or has a separate vulnerability (1), possibly something from [2].
[1] https://bugs.chromium.org/p/project-zero/issues/detail?id=19...
[2] https://www.cvedetails.com/product/15031/Google-Chrome.html?...
The reality is, you don't need to "trust" the source in general, you just need to trust that the source is not malicious. If the source is untrusted but you have faith it is not malicious then you can rely on Android's built in permissions system to protect you from it exceeding the bounds of what you would like it to do.
This may sound very pedantic, but the whole existence of an app ecosystem that isn't controlled by the hegemony of the 2 or 3 big app stores depends on this nuance.
https://www.pcmag.com/news/363357/google-irks-epic-games-by-...
You could claim google has been irresponsible for publishing technical details about this flaw in epics installer too early but it still has nothing to do with Androids permission system.