Code Released To Exploit Android App Signature Vulnerability 81
chicksdaddy writes with news of a Proof-of-Concept exploit for the recent Android APK signature vulnerability. From the article: "Pau Oliva Fora, a security researcher for the firm Via Forensics, published a small, proof of concept module on GitHub that exploits the flaw in the way Android verifies the authenticity of signed mobile applications. The flaw was first disclosed last week by Jeff Forristal, the Chief Technology Officer at Bluebox Security, ahead of a presentation at the Black Hat Briefings in August. ... The simple program leverages APKTool, an open source tool for reverse engineering Android applications — decompiling and then recompiling their contents. His script allows a user to select and then decompile a legitimate Android application and then recompile it, creating an altered, 'malicious' APK that will have the same, cryptographic signature as the original file. In an e-mail statement, Google said that a patch for Forristal's vulnerability was provided to Google's OEM and carrier partners in March, and that some (Samsung) have already shipping a patched version of Android to customers. However, that response hasn't been universal — a reflection of Android's fragmented install base."
So... (Score:5, Insightful)
This simplifies the generation of a hostile patch but, unless I'm mistaken, this still requires injecting the hostile patch into the Play Store via a trusted account or by convincing some sap to side load it.
Gee, 3rd party stores in China and Russia being completely lax on security matters? Go figure.
Re: (Score:2)
Re: So... (Score:2, Insightful)
Isn't the magic if android the fact that you can install from third party sources?
Re: So... (Score:4, Informative)
Isn't the magic if android the fact that you can install from third party sources?
Sure, that's one very nice thing, but it still doesn't allow you to just be a moron and expect everything to be hunky-dory.
TotallyFreeVersionOfSomePopularGame.apk from a site that's written in mostly Cryillic or Chinese characters? Seems legit!
--Jeremy
Re: (Score:1)
So you mean end users should check the digital signature to ensure that it is trustworthy? Or that the site they are retrieving from hasn't been hacked and trojaned?
Oh, wait...
Re: (Score:2)
Digital signatures in android are mostly self signed (you can use a notarized certificate but it has to be issued as valid for 20 years to be on the play store, so good luck). They are for use in verifying updates automatically by the system for installed packages with the same name and for packages requesting to run with shared code or data as another package (upgrade key packages or feature modules for instance).
If you want to verify the source you check the hash or only download from a trusted location.
Re: (Score:2)
Re: (Score:2)
Y'know, there may be reasons why I don't want to go to Google Play even though the .apk I'm looking for is free (and 1$ is practically free). I'm not signed into Google Stores because they insist on me handing over just about everything about me.
I'm _not_ giving access to my location, my contacts, etc.
So, I'm on cyanogenmod and F-Droid for free software.
Re: (Score:1)
So what's your point? You've chosen to use F-Droid to vet your software rather than Google Play; good for you, that seems pretty reasonable and safe.
The whole appeal of sideloading is to give yourself the option to take security into your own hands without Google or Apple or Microsoft babysitting you. You can't demand to get out of the walled garden for a stroll and simultaneously demand that the walled garden keep you safe and then get pissed when you get infected somewhere that the walled garden had no
Only if the developer's web site is compromised (Score:2)
Re: (Score:2)
Or, a mirror site. Which is not as uncommon as we'd like. Furthermore, without any red flags from say, invalid digital certs, detecting this would require some sort of checksum validation - which if the signature worked would be entirely un-necessary, and is the entire point of using a digital certificate.
This is a major, major flaw - essentially the entire point using of digital signatures on android has been invalidated, unless your device has had this flaw patched.
Belt and suspenders (Score:2)
Furthermore, without any red flags from say, invalid digital certs
Are you talking about an invalid APK signature or an invalid SSL certificate? Because even if the APK signature is successfully forged, forging an HTTPS download would require the attacker to either A. compromise the developer's web server or B. both forge an SSL certificate and MITM the user's Internet connection. I will admit that this is easier with Android 4.x, whose SSL stack supports Server Name Indication, than with Android 2.x, which supports only clear HTTP for sites using name-based virtual hostin
Re: (Score:2)
And eliminate useful third party legit sites?
Like say, Amazon App Store? Or Humble Bundle apps?
Sure, you tend to trust these apps as they're from legitimate sites, but are you ABSOLUTELY certain that Amazon and Humble Bundle are checking their files?
Re: So... (Score:5, Informative)
Google PlayStore does NOT use https for actual downloads (check your own WiFi logs). So in theory, if you were connected to an insecure/public WiFi network someone could intercept your download request and replace it with a compromised download using available WiFi auditing tools.
Re: (Score:2)
That's good to know, I'd always assumed it was HTTPS.
Re: So... (Score:3)
It's pretty odd, all the PlayStore APIs are done via https, but then the download is http. No idea why they'd do that.
Re: (Score:2)
... unless there's another signature verification of the download with signature sent via HTTPS. Seems off though since Google does almost everything via HTTPS these days.
Re: (Score:2)
... unless there's another signature verification of the download with signature sent via HTTPS. Seems off though since Google does almost everything via HTTPS these days.
it's so that they can do load balancing cheaper. some of the apk downloads can be quite sizey.
Re: (Score:2)
Does caching mean proxy? (Score:2)
HTTP can be cached easily
Resources served over HTTPS, such as style sheets, scripts, and images, can be cached just as easily by the client as resources served over HTTP. Yes, I'm aware that some web browsers disregard far-future Expires dates and exclude from disk cache so as not to leak HTTPS resources to other applications that can access the same file system. On the other side of a connection, the server can and ideally does cache portions of dynamic pages that seldom change. For example, some of the modules on Phil's Hobby Sh [philshobbyshop.com]
Re: (Score:2)
Caching.
Cache (Score:2)
Hint: real-life hacking is all automated (Score:5, Interesting)
If by "lurk in the shadows" you mean "write a little Python script for a Raspberry Pi tucked behind a chair at your local Starbucks", and by "with a complete set of compromised copies of everything in the Google PlayStore" you mean "have the script be able to inject malicious code dynamically into an any APK in a few milliseconds", and by "sniffing in hopes of intercepting someone's traffic" you mean "running a persistent ARP spoofing attack that routes all external traffic across the network through said RaPi 24/7", and by "quickly to insert a compromised copy of something midstream with a man-in-the-middle attack" you mean "implement basic automated intercepting proxy functionality such as is common in dozens of existing tools"... then yes.
I don't think you realize how easy this kind of thing would be. Computers are tiny, silent, wireless, innocuous, and cheap these days. They are more than capable of modifying a typical APK in flight without introducing a human-noteworthy amount of latency. They can gain a MitM position easily an hold it for as long as the network stays up.
Yeah, those who stick to their cellular networks for app downloading are better off (unless there's a femtocell on that network and the attacker has access to it...) but for a few hours of hacking and less than $50 per location counting WiFi adaptor, you could catch a lot of people using WiFi on their phones.
Re: (Score:2)
Re: (Score:2)
It still sounds like $50 per location to install something that gets 5-6 opportunities a week to inject malware. If the traffic being intercepted and corrupted was more common than APK files, it would maybe, possibly, be cost-effective to maintain this constellation of $50 Raspberry Pi systems in local Starbucks. As it is, people don't install new APKs that frequently, let alone install them in coffee bars.
It does sound like the big return would be in nabbing Raspberry Pi hardware you find hidden behind c
Re: (Score:2)
Google Play has already fixed this so you would have to target other sources of applications. When you download an APK Play itself verifies it even if the OS hasn't been patched, and everyone going back to at least Gingerbread (I think even Froyo and Doughnut too) gets updates to Play.
Re: (Score:1)
Do Google Play downloads go over SSL? Does Google Play fail to work if the SSL verification fails against the installed CAs? Does that Raspberry Pi have its SSL cert installed on the phone?
It's not that easy...
(...or maybe it is, I'm assuming Google wasn't stupid when it comes to the first two questions.)
Re: (Score:2)
Re: (Score:2)
Also note that I believe Google is now scanning for APKs that have duplicate file entries - so this should (or will soon) get blocked right in the Play Store even with a trusted account, and also will likely get caught by Google's sideload malware scanning capabilities.
In short, this "master key" is of no impact to any user that applies the most basic levels of common sense (don't sideload shit from sources you don't trust.)
This Is The Problem With Smart Phones (Score:1)
Their is a big difference between OS vendors' attitudes toward mobile devices and desktop/laptop computers. Many phones will never get - or even be able to run - the newer versions of Android that will have this flaw patched. Desktops & laptops get much longer support for their OS's.
Yes, I know some Apple computers can't run the latest and greatest anymore. That's due to a hardware architecture change that took place several years ago.
Re: (Score:1)
Your an AC. Their not going to care.
Re: (Score:2)
Re: (Score:3)
The 'get' is very true, the 'be able to run' is less true.
If you look at some of the current 'budget' phones running 4.x, the specs are equivalent to previous phones which have ended with support for 2.2 or 2.3.
Also, many phones have quite functional CyanogenMod releases based on 4.x when the most recent official release is 2.2 (Motorola Defy for example) or 2.3. This reflects a problem of desire on the part of manufacturers. (Perhaps also a problem of a lack of legal obligation to provide at least security
Re: (Score:2)
*shrug*
Back when I was a kid, people upgraded their own computers: From MS-DOS 3.3 to MS-D
Re: (Score:2)
Installing ROMS is pretty easy. It's the initial rooting and installing the compatible recovery that could go wrong and brick the device. Some phones such as the Samsung Galaxy Skyrock is ungodly easy while others can cause sweat beads running down your face while doing it. I was scared shitless while rooting my HTC Thunderbolt. It was the first phone I ever rooted. When I bought my Note 2, I had it rooted within 15 minutes of getting home from Best Buy. It was rather easy thanks to Samsung's built in
Re: (Score:1)
Indeed, also many of these fixes can also be/are already backported to older releases. The manufactures just don't care enough to build and test them and if they did the carriers don't want to send a patch through QA and the side deals for many branded phones don't let the manufactures publish updates directly.
A malicious APK? (Score:5, Funny)
There's only one solution for a malicious APK.
We need a custom HOSTS file ...
Re: (Score:2)
nonono! We need to assign a governmental agency to watch all our traffic and block all malicious content.
Looks like AC had it already (Score:2)
From a previous AC comment [slashdot.org]:
APK's are signed with what amounts to the normal jar signing process. So either they have found a way to create a hash collision, or there's some other bug in the verification process that allows some unsigned code to be included in the file and executed.
Either way, you will still need to trick people into installing your version of the apk.
My guess is this: android just checks the first files matching in the jar/zip for the names, but installs the files found last in the jar(or vice versa, zip files can have multiples of the same filename).
Re: (Score:2)
Re: (Score:2)
When they mod a package it no longer matches the APK signature. On many Android phones if you install a custom (unsigned) kernel you will get a yellow triangle during boot.
I still don't get it... (Score:1)
http://threatpost.com/android-vulnerability-enables-malicious-updates-to-bypass-digital-signatures/
“Users need to be cognizant of the source of applications they’re installing and trustworthiness of the source of APKs if they’re not installing from Google Play,” Forristal said. “If you don’t know where the APK came from, it’s no different than grabbing .exes from the Net. Make sure you’re not using apps from untrusted sources and stick to Google Play; Google m
Summary of the exploit (Score:5, Informative)
Re: (Score:3)
Looks like the fix they have applied will cause java.lang.zip.ZipFile to throw a ZipException, indicating a format error, whenever it encounters a duplicate entry in *any* zip file, for *any* application using android's dalvik JVM.
I'm not certain that's the correct response to this issue. Should a zip file with duplicate entries always be considered invalid?
Re: (Score:2)
I imagine that's how the exploit worked, when they checked the signatures, they just unzipped the first file that matched the signature name (which would be the original file), then they unzipped it, the first file being unzipped first, then the second file being unzipped and replacing the first.
Re: (Score:2)
What would that exactly mean, to have duplicate entries in a zip file? How would you even unzip it? You would end up having two files with the exact same name in a directory, an impossibility in most filesystems.
I imagine that's how the exploit worked, when they checked the signatures, they just unzipped the first file that matched the signature name (which would be the original file), then they unzipped it, the first file being unzipped first, then the second file being unzipped and replacing the first.
you can just pick which files you unzip out of the zip. there's no problem in the format itself, there's no rule saying that you would have to unzip them all at once. this is the thought hole the google developers fell into. I don't understand why they don't sign the zip file itself and add the signature as a block at the end of fixed length(the way .jar signing for j2me worked was that you had to have the .jad application descriptor file distributed at the same time, that complicated things a lot in regard
Re: (Score:1)
Re: (Score:3)
Re: (Score:2)
Re: (Score:2)
So basically the signature only verifies the first instance of a file it finds in the archive, but when extracted it extracts the latest. In fact ZIP (and RAR IIRC) allow overwriting a file with a newer version later in the archive; probably a hold-over from the floppy-swapping and/or tape days when you needed such abilities.
Reminds me of the chimera file exploits that use the fact that many common file formats like ZIP and PDF will ignore extraneous data, scan into the file looking for a header, etc to mak
Re: (Score:1)
That is unbelievable that they would overlook that. Thanks for the explanation.
That's ...helpful... (Score:1)
to people who want to use the exploit to compromise your phone. It's not helpful to Android users or to legitimate developers.
How does that help me? (Score:3)
Google said that a patch for Forristal's vulnerability was provided to Google's OEM and carrier partners in March, and that some (Samsung) have already shipping a patched version of Android to customers. However, that response hasn't been universal — a reflection of Android's fragmented install base."
It's nice that Google's OEM and carrier parters are getting a patch but what's their mechanism for distributing the patch to the installed base of Donut, Eclair, Froyo, Gingerbread, Ice Cream Sandwich and Jelly Bean users in the field who would like their phones to not be infected with malware? And does it affect Kindles and other systems running on Android forks?
Google Play Services (Score:3)
Re: (Score:2)
a lot of the attack would be mitigated by simply having the apk downloads from the market be https.. they don't need to update android itself for that, just the play store client.
Android security updates? (Score:2)
It seems that most Android manufacturers don't upgrade major versions for their phones (2.3 to 4.x).
That may make sense because the newer versions may relate to features or power the older phones don't have.
But do the manufs/Google at least offer minor upgrades (2.3.x) for security/backport purposes?
It seems that Google offering a patch which would only go into new Samsung phones is about useless.
Re: (Score:2)
Old devices running on 2.3 will never see updates as they're already considered long out of support. 2.3.x devices might see something due to GB still being widely used by cheaper and older devices. 3.x devices are dead and buried
Re: (Score:2)
Buy a new phone. You know they want you to.
Re: (Score:2)
they could just distribute the patch through a new google play store client.
anyhow, the way the attack works is laughable, like they had a perfectly brilliant idiot design the system(who didn't know shit about how zip works). bad, bad google.
Re: (Score:2)
If you're thinking about how this could be exploited by tricking people into downloading a malicious app, you're thinking about it the wrong way. The greatest danger of this exploit is that it could be used to access the "private" data of any device you have access to. Android will not allow you to install a new version of an app over adb (think USB console) unless the signatures match. To install a malicious version of an app, you'd normally have to uninstall the old version, deleting its data with it. But using this exploit, you could install a version of the app that would reveal the data. So now a stolen phone is not just a stolen phone; its potentially a stolen identity.
not really. you could mitm the apk downloads from play store(it's plain http).
Re: (Score:2)
Come to think of it, this would allow security researchers (of any hat color) to audit the "private" data stored by any app. Having seen how some supposedly "secure" apps handle their data, this could be illuminating. My guess is that Apple's shareholders would love to see such a survey.
App stores == terrorism?? Work with me here... (Score:2)
It's kind of interesting to me how what we've seen with the rise of the app store model has largely mirrored what we've seen in the "real world" post-9/11. It hasn't quite been simultaneous, but pretty close.
What I mean is that a lot of people love the app store model and always say how it's "safer". Especially when talking about Apple, you have a gatekeeper checking on the safety of apps, to at least some degree. They ensure what gets through won't hurt you (in theory... but, to be fair, they do pretty