Critical Bluetooth vulnerability in Android
insinuator.net
insinuator.net
The situation on the phone market is so miserable.
The industry forces us to throw away perfectly fine hardware after just 3 years or so.
watches the plan fail yet again
This is like saying "we dont need regulations in meat packing, every individual can become educated in butchery cleanliness and track the supply chains for the products they buy and everything will be better!"
It's easier to achieve regulation when people care and show that they care. It seems to me, voting now with your wallet is one of the most direct ways to make a case.
> I vote for what I think is best.
Maybe you're an exception, but if you're talking about "vote with your wallet", then the vast majority will actually vote what they think is best for their wallets.
I mean, if you're going to let money decide, then expect the outcome to benefit money.
People say this kind of thing all the time, even on HN. It's a libertarian saw that the FDA is unneccesary and obstructionist. Personally I think it's deranged, but apparently it's an ideological battle that's still being fought.
If you mean "a bunch of relatively new Android phones not getting security updates because their manufacturer doesn't support them", then yes. Apple is actively providing not just security patches but entire feature software updates for the iPhone 6S, which is 4.5 years old at this point.
Did this already happen? I only remember the announcement and then researchers on Twitter complaining that the first one is yet to be seen.
iOS ecosystem. Since Apple is a hardware manufacturer foremost, you notice from the start you aren’t the product. Lots of apps, many of high quality.
Librem/Pinephone : Linux phones. While the hardware is still closed source in certain parts, it’s a step up from what we have now. Librem allows you to install any linux variant you choose.
Zerophone : Build your own phone basically, very cheap to build ($50) , and currently in development.
There is more to a phone than just the cpu.
I'm gonna keep these things running as long as I can, because the prospect of replacing them with something a decade newer but inferior in every meaningful way is simply sad.
LineageOS is the only reason I don't loathe the whole Android ecosystem, to be honest.
Rooting permits applications to have more control over the device at runtime. Some devices require the bootloader to be unlocked to enable rooting, and others do not.
Nokia is the best though: https://www.counterpointresearch.com/nokia-leads-global-rank...
they support even their very old phones to upgrade up to the latest version of Android.
It is missing the Jan & Feb 2020 updates that the Pixel 2 received, but it's plausible the Pixel 1 could still get a patch for this critical issue.
Less dangerous, for sure...
And get locked in another walled garden? Erm... no thank you.
You can appreciate the longevity and continued support of an iPhone without having an Apple Watch. You can appreciate a MacBook for its OS (pre Catalina anyway) and build quality (I'm still running a 2014 model -- though I have read about recent models' issues) without having an iPhone to pair it with. To be fair, you cannot appreciate an Apple Watch without an iPhone at all since it won't do anything, and I'm no the fence about AirPods and how well they do outside the Apple world.
My point is, once you're in the ecosystem, you notice a lot of little things that may make your life easier. Are they great? Yeah absolutely. Are they what sells the product? In my opinion, not at all. Unless it happens to pinpoint your exact use case (I need to lock and unlock my MacBook 30 times a day and I'm tired of having to enter a password, I want my Apple Watch to unlock it), it's the product itself that will most likely convince you. The way they neatly play together at times is just the cherry on top, like when you notice your computer and phone now share a clipboard. That's awesome, but not a single selling point for anyone.
Now, I will be the first one to say: iTunes sucks. So, if you do buy an iPhone, it makes sense IMO to shed out the extra 99ct a month for iCloud storage.
I didn't want my comment to sound like I'm saying Apple does it best. I just wanted to drive the point home that I don't think it's mainly the ecosystem that makes Apple devices fun to use.
As a side note, I wasn't talking hardware that lasts 5 years. We all know most devices on the market now can pull that off, bar one battery-replacement. I was rather talking continued software updates, where iOS is certainly in the lead.
Edit: just re-read your comment and you were talking Apple computers specifically. Oh well :)
I feel like that only furthers my original point though. I didn't want to argue that Apple does it best, only that you can enjoy their devices without being fully bought into the ecosystem.
The current options include all Nokia smartphones, Motorola One line, and Xiaomi Mi A line.
For the best hardware and 5G support, I would look at Nokia 9.2 (Snapdragon 8--) and Nokia 8.2 (Snapdragon 7--) releases this year.
The best deal is to buy 6 months after the release, when most Android devices become heavily (30-40%) discounted, but are still quite new.
I prefer Android over iOS because of the freedom to install open-source OS-level ad-blockers, such as Blokada[1], which greatly improve privacy and battery life.
That's true. Just like Samsung, Huawei, OnePlus, and any other Android manufacturer except Nokia, Xiaomi maintains its own Android ROM, called MIUI[1]. It's not as vanilla as Android One, but at least it also receives monthly security patches.
> Among which is the need to "sign up" online for bootloader unlock and wait for a timeout period. They do this because resellers used to ship bootloader-unlocked versions with "unofficial" mods of sorts, often with customers being none-the-wiser. Not an issue on the 'Mi A' line, for whatever reason.
It's not an issue with Xiaomi Mi A line, because Xiaomi's reputation is not affected as much if there is something wrong with a smartphone that is not running its custom ROM.
Nokia has only recently started allowing to unlock the bootloader of some of the models, and has a similar process[2].
And any custom Android ROM requires drivers to be able to completely support the hardware of a particular device.
[1] https://www.howtogeek.com/241012/safetynet-explained-why-and...
Librem/Pinephone : Linux phones. While the hardware is still closed source in certain parts, it’s a step up from what we have now. Librem allows you to install any linux variant you choose.
Zerophone : Build your own phone basically, very cheap to build ($50) , and currently in development.
Also FWIW, the problem has zilch to do with "Android" per se - pre-Android mobile Linux was even worse. It's embedded platforms in general.
Having a "standard" OS interface for the phone, where there is just one OS image for a given OS version, and that image could be installed on any phone - now that would be the true alternative, which I would be delighted to vote for with my wallet.
Project Treble is working towards this, in a way. But it's a huge hack that's still dependent on lots of weird AOSP-specific stuff, and doesn't even give you a "single" OS image for every device - the "proper" image for your device varies by baseline AOSP support (7, 8, 9, 10), "A" vs. "A+B" boot and of course 32-bit vs. 64-bit architecture. Nowhere near "UEFI-based PC" territory.
Sure, but each PC is also 'unique' in that sense, in fact I'd happily bet that there are more different kinds of hardware combinations for PCs than there are android phone models. And yet, that never was a problem.
for i in range(256):
poke(i,magic1)
if peek(i) == magic2:
found!
256 probes in all is not that bad, and real-world probing would only try a handful of commonly used addresses, making it even faster.Phone SoCs on the other hand have many peripherals memory-mapped, (meaning there are millions/billions addresses to 'probe'), plus there are things like power sequencing, GPIO enable lines that need to be asserted, and clock-sources configured before peripheral would even respond at all. Oh, and that GPIO, or power controller, or clock source themselves might be accessible via an i2c chip speaking its own protocol, so you need to initialize those first, etc, etc.
All of this complexity could be described via linux "devicetree" subsystem, and devicetrees are in a usable state for some hardware (although DT itself is often a labyrinth to navigate). Thing is - factory software for most phones have been extremely slow to adopt DT, and even some that do use DT, don't do it in a particularly portable way.
Better go with a Pinephone if everything that's been written about Librem as a company is even half-true.
If I have $200 to spend on a phone, I will not buy a low-end 2019 $200 phone.
I will buy a used (or new-old-stock) flagship that was $700 when it came out a few years ago, and is now $200 on the used market.
The older flagship will have similar specs to today's low-end junk, but also all the enthusiast support, better accessory availability, and probably better build quality overall, because it was originally intended to be the highest of the high-end.
I've saved hundreds of dollars of technology on trivial home repairs instead of buying replacements.
That means there is no Android or Apple device on the market today that accomplishes what you say.
The only phones that are out there that can do that are the Pinephone and Librem 5. I have beta devices of both, and while I am extremely excited to see them mature and turn into daily drivers, the fact is neither can actually be a daily driver today.
Can you name one smartphone device with open internals? I'd love to buy one, but I don't think they exist. From Replicant's recommendations [1]:
If compromising on privacy/security is not an option, or anything serious is at stake (e.g. political activism or journalism in a sensitive area), it is advised to avoid using a telephony-enabled device at all.
My impression from the smartphone market is that phone platforms have become less open, not more, over the last ten years. The PinePhone isn't generally available yet, and the Librem 5 current iterations don't have working audio calls.
[1] https://www.replicant.us/freedom-privacy-security-issues.php...
Mainline Linux:
https://pocket.popcorncomputer.com/
Mainline Linux + high-level hardware documentation:
* The barrier of entry is very high: You need a top-tier manufacturing system and supply chain. An operating system. An entire suite and market of applications. All of the apps users expect and rely on (mail, navigation, Facebook, chat, Instagram, etc.) must be supported. The hardware is only profitable if you manufacture at very high scale.
* Information asymmetry is very high. Users have almost no insight into how secure one platform is versus another. In fact, they have access to paradoxical information. The most secure platforms are the ones with the most transparent security flaw handling, but those are also the ones that appear the least secure because the vulnerabilities are more widely reported.
* Products are nowhere near commoditized. A phone is a very large constellation of hardware, operating system, and software features. There is no apples to apples comparison between phones. Maybe you like the camera on one but not the screen on the other. One has better apps but the other a more stable OS.
This is not a market where consumer choice will effectively drive solutions to diffuse problems.
"Voting with your wallet" only leads to good outcomes if the incentives are right. I mean it's money, the VAST majority of it is spent not for the greater good but for small, inefficient egotistical purposes.
https://www.moneysavingexpert.com/shopping/consumer-rights-r...
You'd only need to do it once to set a precedent, and everyone can get their phones fixed or replaced. The problem is that the law applies to the retailer, not to the manufacturer. As I didn't buy my phone direct, I'd have to get the retailer to replace it, and as I went to a high street retailer who is suffering from competition from Amazon etc, and closing branches, it feels bad to give the problem to them.
If I'd bought the phone from the manufacturer direct, from Amazon, or from a phone network, I'd gladly go ahead with the action because those retailers would have enough clout that the manufacturer would care about loosing their business.
https://www.gov.uk/make-money-claim
I've done it myself and got paid by an intransigent phone retailer relatively promptly after that point. My lawsuit was about a contractual dispute rather than faulty goods though.
”Under EU rules, a trader must repair, replace, reduce the price or give you a refund if goods you bought turn out to be faulty or do not look or work as advertised.”
So, the manufacturer, in the EU, never has anything to do with the consumer, legally.
I think a trader could successfully argue they didn’t advertise the device as secure, that the user didn’t suffer from it or, for devices that are out of warranty, that they don’t need to correct this issue anymore. claiming that it wasn’t ‘faulty’ could be harder, but I’m sure they would try. If a vulnerability isn’t known, is it a fault? Depends on whether its cause was generally known, I would think.
"The legal guarantee covers any defects presumed to have existed at the time of delivery and which become apparent within a period of two years. However, the crucial period is the 6 months after you bought your product:"
https://europa.eu/youreurope/citizens/consumers/shopping/gua...
So I'm assuming the bulk of older phones would no longer be covered?
Since when? Economic theory explains that they are expected to do no more than that, or else they'd leave money on the table.
Not sure what you're referring to. Chapter 11 is a form of reorganization in bankruptcy in US law.
Volkswagen AG (i.e. the VW Group) is an EUR85 billion German company that - despite the massive fines and recall - has been consistently profitable, with a small loss in 2015 due to the aforementioned issue and earned ~EUR12 billion in net profit last year.
https://developers.google.com/android/images
I have a Pixel C that will never have an official patch to this exploit. I wonder if this is a user space exploit too, and if so, that would mean there's no technical reason for why they can't update it.
I'll take a look at Postmarket, I didn't know they were working on it. My issue is that I use the tablet primarily as my music workstation, and there are several apps I use that depend on Google Play.
I do have a Pinephone, and I would honestly prefer to use my time to get a matured OS for that.
EDIT: I looked around on PostmarketOS, I did not see anything for the Pixel C? I just saw an external resource on how to boot Linux onto the Pixel C
He was just talking about the wishlist I think, which is this one I guess: https://wiki.postmarketos.org/wiki/Device_Wishlist
But I don't see it there either.
The old iPhone is going to work as well as, if not better than, a new android device - Apple tends to be about 5 years ahead of Qualcomm in performance, and they actually service their devices. My mom is using my iPhone 6S from 2015 that feels about as snappy as my 2018 XR. And that feels snappier than a pixel 4.
Very few people are software developers so the Mac req to develop is a non-issue.
[1] https://www.zdnet.com/article/no-gpl-apps-for-apples-app-sto...
And then, to actually develop software, I would have to work on this mac operating system. I don't know who came up with their keybindings and shortcuts, but it's an absolute inconsistent mess when compared to any other OS. Whenever I have to touch a mac to assist a coworker it's utterly frustrating.
Phones are not usually in that state unless the BT settings screen is open. Otherwise it would drain excess battery in normal use.
While scanning for devices, a phone reveals the Mac address. There are other ways to know the Mac address too.
Almost every month there are security patches for "critical" problems. Just skim throught the blog pages. This is Jan 2020 for example: https://source.android.com/security/bulletin/2020-01-01
Consider this: if I remember correctly somebody on HN was saying that in these days the average time from releasing a patch and exploit found in the wild is 4 days.
Consider that the patches hit the open source code a lot before they are deployed.
Consider that beside Google, any other Android phone manufacturer take around a month before releasing the patches even on current models.
The situation has no easy solutions.
Still the biggest problem. For my PC I can install updates on a daily basis. For my smartphone, I can be happy if there are any updates at all.
The worst part is that people keep using the phones because are not tech savvy or grossly underway the risk and they do not feel that they need to spend money on a new phone.
Possibly because of things like this; when a vulnerability isn't going to get patched, churn (with new hardware running newest OS) protects the ecosystem against mass-compromise.
We can bemoan the lack of patches, but who's paying for the patches?
When you can make a ridiculous profit on a flagship phone and sell it for $500-700 (say, a OnePlus, for a good example), but they sell it for $800-1400 (Samsung, Apple, et al), then what am I paying for? It's supposed to be for better support and a smoother experience when things go wrong.
You know who has historically stabbed me in the back the least? OnePlus. I'm not going to say it has been perfect, but for a phone I spent $550 on, they've screwed me far less times than other alternatives would have.
So, we are paying for the patches to be delivered on a meaningful schedule for more than 3 years. I seem to be getting it what I paid for, and you don't.
There is something massively wrong with this picture.
You are paying for 5 years of updates.
And a superior phone.
I use bluetooth constantly for my smartwatch and headphones.
I think it's time for custom firmware just because of this. Goodby banking apps and Google Pay, because apparently a newer but unofficial OS is more insecure [1].
I remember the times of endless tweaking and patching after some Google Play services update a few years ago.
It's unreliable by definition. You're better off keeping a device around with the stock OS on it, that you only use for SafetyNet-required stuff.
Reason #4373 that ditching the headphone jack is pure insanity.
Sigh.
The Denon system might be using LDAC which is higher quality, but sacrificing latency.
And since I don't wanna carry two pairs of headphones around my phone needs to have a headphone jack.
Recently the wire of my regular ear buds gave up (as they do) and, since I had gotten some BT ones, I decided to use them. They're Jabra Elite Sport, which got good reviews from what I can recall.
They're dropping out like crazy. It's seldom to get an entire minute of music without a small dropout. The area around the bus stop at work is particularly bad, with sound drops every few seconds until I get away from that area.
I upgraded the firmware and it got a bit better, but still pretty poor. If I hold the phone in my hands and keep still it's usually ok, but as soon as it goes into my pocket, all bets are off.
I don't miss the cable tangle, but I miss being able to enjoy music.
AirPods are one fine product for daily casual use. Obviously they aren't going to meet an audiophiles demand at $150 but AirPods Pro might even be enough in that case.
My AirPods drop out at the rate of once a month or something. When it happens it's a quick fix and they have been nothing but convenient otherwise.
Would never use wired headphones again unless I am trying to analyze a Beethoven piece.
I didn't think BT headphones were worth anything until I tried them. They are surprisingly liberating for someone active like me.
For sure.
> Everyone speaks like they work for marketing now.
Maybe we're so inundated that we've internalized it? A semi-related thing I've noticed: when people talk about movies now, it's never "oh I liked it, it was neat" or "it was sappy." Everybody talks about the cinematography this, the character arcs that, did you see that tracking shot??
It's weird to see the "inside baseball" aspects of movies/music/storytelling/etc creep into random conversations.
Because in general, BT headphones are great and I understand that people love them. But Airpods are not among the better ones in my experience. They drop out more than my other BT headphones, and the fact that they have no volume control is just unbelievably stupid to me.
If we’re talking AirPods Pro you could buy new $30 ones each year for the next 8 years, but atm nothing out there seems to compete with transparency mode while still having the fit of a silicon tip and no sealed in feeling/internal pressure noises.
For me I'm not going to spend a lot on any until the latencies are good enough for gaming, along with stereo while using the mic, and will stick to the cheaper ones until then.
When I switch on the office lights, enter the lift, open the fridge door (light again) and similar things, the left drops out briefly (on the order of 100ms).
It makes some analog radio noises when they fade out and back in, so clearly something entirely different from BT.
The right earbud plays music as normal through it all.
Frustrating reality of modern purchasing - buying the "expensive" one often gives you something not substantially better than the cheap Chinese junk.
https://www.theverge.com/2019/11/7/20943377/chinese-hi-fi-au...
That said, I’m happy with my AirPods and Beats, which are on the expensive side. The custom Bluetooth chip is certainly more seamless than regular Bluetooth.
>They're dropping out like crazy. It's seldom to get an entire minute of music without a small dropout. The area around the bus stop at work is particularly bad, with sound drops every few seconds until I get away from that area.
I would suggest reaching out to Jabra, as the symptoms suggest a faulty pair. Furthermore, these buds came with an extended 3-year warranty, albeit it was for failure as a direct result of perspiration.
I use mine the with an iPhone, and also tested them with an older Android phone with Bluetooth 4.0. The firmware is on release 5.6.0 (6th November 2019). Although, my pair doesn't suffer from the same issues as yours. However, I have had some issues with the battery life e.g. Jabra Sport app and real world usage does not tally and the battery life of the buds also deteriorates by 10% or more, by just sitting in the charging case, if not used daily.
Playing the movie is going to use enough battery that I'd like to be plugged in. The dongles are easy to lose. I don't have a set of bluetooth headphones that I use regularly, so I got a pair at the airport, but i need to remember to charge them, and they also don't last for the whole movie. Also, everybody using bluetooth probably contributes to the janky streaming in flight.
Characteristic impedance alone is all over the map, Apple apparently couldn't align its 3.5mm jack pinout with the rest of de facto industry, and form factor is just one of many inherent market differentiators.
Pretty soon it will just be one or off brands and the occasional weird model that have them (if it's not already to that point).
The Galaxy s10 hit the critics like a storm. It got pretty rave reviews. I'm on an s9 and I guess that'll be my next phone whenever this one dies.
but the way things are going I can't see a phone like this ever being made again. so ill be using this for the foreseeable future and will probably have to start using a custom rom in a few years
Maybe I hadn't looked hard enough. But my thought at the time was for my needs I'd have to spend $400 more for a headphone jack on a phone I might not be able to use with my carrier.
I ended up getting the 7 Pro and use a dual headphone/charging adapter. I hate it and wonder what the market has come to if they feel we should put up with this. But that's the tradeoff I chose.
My dream phone is one without the rounded corners or curved screen, an SD card slot, a decent camera (at least Pixel XL quality) and a headphone jack.
I should also mention it's a miserable feeling to think that a standard as hideously broken as Bluetooth is here to stay because it's won out the short distance wireless connection space and there's no going back and retrofitting the billions of smartphones that will be forever fitted with Bluetooth until they're thrown out.
It's a compromise i'd prefer not to be forced to make but it's the best solution atm imo.
Fortunately, my aging GS8+ still has a headphone jack, and I had a pair of analog headphones in my travel bag.
UPDATE: confirmed by later comments in https://androidforums.com/threads/turning-on-bluetooth-in-fl...
Bluetooth was allowed on planes quite some years ago.
Bluetooth: get in reach of an attacker (and from another comment: have your device searching for bluetooth devices)
Web-stuff: if a patched browser doesn't help you are still relatively safe browsing all the non-infecting websites in the world.
file-stuff: you have to be stupid enough to open files, on your phone, from phishy mails (unless you are targeted they are always suspiciously generic, even when spreading from a hacked acquaintance )
I guess if there was a vulnerability where you could remotely gain full control over a phone without any action on the phone side you'd indeed have phone botnets. Looks like there are no such vulnerabilities.
Take what I write with a grain of salt, I'm actually just a noob trying to make sense of this, too.
This part looks very different if the attack is a worm.
How many phones are not in reach of another vulnerable phones at least once a workday?
Stagefright again.
> with the privileges of the Bluetooth daemon
Which priviliges is that? Can it access user data? Snoop on input/output?
> For some devices, the Bluetooth MAC address can be deduced from the WiFi MAC address
So if wifi is off, I'm safe?
I have bluetooth on all the time, because it automatically pairs with my car for cellular and audio, and turning it on and off would be a hassle. I rarely, however, use wifi unless I have to download a very big amount of data, which is almost never.
No, the connection packets can still be sniffed from the air once your device connects to your car. Then the attacker knows your mac address and can initiate the exploit.
This is somewhat addressed in a comment/reply by jorge:
https://insinuator.net/2020/02/critical-bluetooth-vulnerabil...
> Hi, the Bluetooth daemon is a process on the Android system that runs in the background (daemon) that is responsible for managing the Bluetooth controller and handling of various Bluetooth related protocols, such as HCI, L2CAP and GATT. As it has to process attacker-controlled input it is susceptible to attacks. In addition, it has to run with high privileges (not as ‘root’ like on Linux) to support features like: – file transfer => read files – share Internet connection => configure network and VPN – Human Interaction Devices => emulate keyboard and mouse
It is likely to be a long time to never for most Android phones to receive patches for this :-(
Is this true?
But I haven't ever seen a bluetooth headset that support analog audio.
If yes, then most phones are safe even if they have this vulnerability, it's only when you go in the Bluetooth menu that you are at risk...
Android has a feature of "Bluetooth scanning" to improve device location (similar to Wifi scanning). I'm not sure, but even if Bluetooth is disabled in the menu, this might still activate Bluetooth occasionally and perhaps reveal the Bluetooth MAC to the (nearby) world?
Which ones would that be? Anyone know?
Does this mean your MAC address isn't visible while on, non-discoverable and connected to a BT device?
Not that this is good design, mind you, but if you turned both settings off and still say BT activity, then that is much different.
Or is it just discoverable when you click "pair new device"?
https://android.googlesource.com/platform/system/bt/+/1d788d...
https://android.googlesource.com/platform/system/bt/+/c20f24...
https://android.googlesource.com/platform/system/bt/+/abc302...
Keeping code simple and without unnecessary abstraction is a far more valuable skill than $safe-language-trend-of-the-day.
How many people must use it? 1k? 10k? 100k?
It’s pointless to argue with someone who throws Rust into that category at this point because it means nothing. It’s a slight to allow them to feel ok, that eventually this language too will pass, and so it will be ignored.
Judging by the number of memory vulnerabilities found each year in mainstream operating systems (which are developed by some of the best programmers around), there aren't any people on the market with this skill. This is very likely because all programmers are human beings.
Manually managing memory isn't difficult, it has been proven to be practically impossible. I wouldn't care if it were Linus claiming otherwise, it's ignoring incredible amounts of evidence to the contrary and is much like flat-earther.
Learning Rust and with its concepts improved my C code. Even if Rust would vanish over night I wouldn't regret learning it.
That's a pretty silly thing to say.
Writing code that doesn't crash isn't the hardest thing about writing low-level code. Sure, it's a problem, even an important problem, but there's a ton of other knowledge that no JS developer would have. Unless by "write" you mean write 2 lines per day with lots of searching in-between that has to be thrown away in the end.
Good programmers are expensive. The notion that better tools are going to change that is naive.
Rust is good. Use it for things. But the idea that it can let people who don't know what they're doing write secure code is dangerous. For example, what does Rust do about Spectre? Does your junior-level JavaScript programmer know how to address that? What about other timing attacks, or knowing which crypto to use in which context?
People still have to know what they're doing.
I've used Rust for a while, and this isn't really true. At the lowest level you still have to build good abstractions with judicious use of `unsafe`. It also comes across as incredibly hostile, you're not doing Rust any favors with this.
Can't see how that can be. Only a small minority of programmers can code low level systems. Only those that truly enjoy it, go through the pains necessary to have adequate grasp of it.
LOL, I wish. I've been told I was going to be replaced every 5 years for the last 20 years of my career. I fucking wish they did so I could finally retire but I keep being given money and cool problems so I stay waiting for this fangled replacement who will come and take my job.
I guess you are talking about the first commit I linked. The problem here seems to be that some events of the kind HCI_READ_RMT_EXT_FEATURES_COMP_EVT can be shorter than the assumed 13 bytes. The code contains no check for that and if the events are shorter, it would read data from after the allocation. It would use that data to index inside arrays, etc.
Now, if you just allocate a buffer of 256 entries but don't do anything else, it wouldn't read data from outside the allocation, yes, but it would still read uninitialized data, as nothing would be written after the end of the valid data. That uninitialized data could e.g. come from previous freed allocations. This would hardly be an improvement. You'd have to allocate and zero-initialize it, and then you'd still have the problem whether zero is invalid data or part of the allocation... Even if code would figure that out, it would be extremely smelly code and I'd never merge it in any projects I maintain.
The approach done by the patch to just check the length is much much better. The length is sent as part of the event.
> Keeping code simple and without unnecessary abstraction is a far more valuable skill than $safe-language-trend-of-the-day.
This code almost directly maps to the bluetooth host controller interface which is part of the published Bluetooth standard. So you can't change the core concepts of it. There are a few abstraction layers which copy the data for some reason from a new/delete managed hidl_vec to a malloc/free managed array (check hciEventReceived function in hci/src/hci_layer_android.cc). Yes, I'd say that some of those layers are indeed unnecessary. But those abstraction layers are not where the vulnerability occurs. It occurs in the code that parses the message, and the bug is that the code does not check the length of the input data. This is a classic bug that can occur in C/C++ codebases.
Safe Rust prevents OOB writes/reads by performing bounds checks when you index into a slice.
The issue with languages like C is that verifying that code is safe is extremely hard, even harder than writing it in the first place. This codebase seems to have not been written by Google but by Broadcom, so Google would have to verify whether what Broadcom wrote is actually safe. With Rust, such verification is easy. If your code makes little use of unsafe, and most code doesn't actually have to, it's easy to verify its safety (at least for the classes of bugs that Rust eliminates). Due to the strong typing, other types of bugs are made harder to write as well.
That said, regarding:
> safe-language-trend-of-the-day.
I agree that rust advocacy can sometimes be a bit misguided and over-enthusiastic - however how often is an out of bounds write not a bug (or a too clever by far hack)?
We've had pretty efficient ways to deal with this in c like languages for a long time (eg Pascal, Ada).
(c-like in the sense of being relatively low-overhead, close to the hardware wrt memory layout etc).
This will take a couple of decades, but it's a worthwhile effort.
My point is, of course Rust is a memory safe language, and of course it would theoretically prevent overflow exploits, but throwing in "you should've used Rust" when this news is announced isn't helping anything. I am certain that Android devs are at least aware of Rust and it's benefits.
There is still not a single Android ROM component that's written in Rust. Cuttlefish uses crosvm which is Rust based, but it's a VM for Android testing rather than a ROM component. So they aren't even ready yet to experiment with shipping small components in Rust. Same goes for Chrome btw, it currently has a "no Rust allowed" policy, which is IMO very sad.
So yeah I think it's worthwhile to talk about why AOSP doesn't have Rust components yet, especially as patching is sadly not available (yet) for most deployed devices. Large fleets of devices will have the bug for eternity. Therefore, prevention of vulnerabilities becomes even more important, which Rust helps doing. Your program won't be free of them, but as I pointed out above, these bluetooth vulns fall into the class that safe Rust eliminates.
But I think this vulnerability serves as an important lesson about which language to choose for new projects in the embedded area. Thus I'm very glad that Google uses Rust for its new OpenSK security key firmware. I hope that future versions of Android will adopt Rust, at least in newly written components. Some Google developed Android related projects are already using Rust, like Cuttlefish which uses crosvm.
Yes, that's not wrong, but a sane (ptr, len) "slice"/"buffer" type would have prevented this in any language, not just rust. These things happen not because C and C++ lack sophisticated ownership semantics, but because without such a type, passing a pointer and hoping the buffer is always big enough is just easier than doing the right thing.
If this was something funky like a cross-thread race-condition dangling-pointer double-free, you'd have a great point. Only Rust's unique safety model can prevent that. But with things like this, as much as I love Rust and it's community, I sometimes feel like many rust fans are much more interested in being smug than making real-world progress towards safer software today.
We've spent decades pushing the limits of security improvements we can get through asking people to please try harder and do better with C, but we still see a high rate of high-impact errors like this.
Rust's safety model isn't the only valuable thing about Rust. Another big valuable part of Rust is that instead of giving the programmer a box of unsafe tools and a post-it reminding them to be careful, Rust provides sane, safe default tools that have been built based on what we've learned from the past several decades.
The argument isn't "Only Rust can save you", but that Rust is a good choice that both meets the same performance requirements, and avoids these problems by default.
If you've got a better solution to persuade C and C++ developers to consistently and reliably always wrap their use of pointers from other APIs into (ptr,len) buffer types, I'd love to hear it!
With comments like this, I sometimes feel like many developers are much more interested in smugly dismissing a group that's made significant real-world progress in making it easy to do the right thing than they are in actually helping real developers to reliably make safer software today.