[TIMOB-20431] Android: Google Play security alert for insecure TrustManager
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-03-21T02:10:46.000+0000 |
Affected Version/s | Release 5.1.2 |
Fix Version/s | n/a |
Components | Android |
Labels | android, httpclient |
Reporter | Luca Sartori |
Assignee | Hieu Pham |
Created | 2016-02-18T14:43:17.000+0000 |
Updated | 2018-08-06T17:57:44.000+0000 |
Description
Few days ago is appeared this message in google developer console for an app that i published several months ago:
_Security alert
Your app is using an unsafe implementation of the X509TrustManager interface with an Apache HTTP client, resulting in a security vulnerability. Please see this Google Help Center article for details, including the deadline for fixing the vulnerability. Please address this issue as soon as possible and increment the version number of the upgraded APK. Beginning May 17, 2016, Google Play will block publishing of any new apps or updates containing the unsafe implementation of the interface X509TrustManager._
https://support.google.com/faqs/answer/6346016
In my app i dont use https connections but simple http.
How can fix this problem?
Thank you in advance for reply
I have also received this security alert from Google today! It seems it needs to be fixed before May 17 otherwise all Ti new apps and updates won't be able to be uploaded to the Google Play Store.
+1 I gave apps with http only connections and an app which connects with a lot of https servers with self-signed certs. Solution?
I got the same by email today: Hello Google Play Developer, Your app(s) listed at the end of this email use an unsafe implementation of the interface X509TrustManager. Specifically, the implementation ignores all SSL certificate validation errors when establishing an HTTPS connection to a remote host, thereby making your app vulnerable to man-in-the-middle attacks. An attacker could read transmitted data (such as login credentials) and even change the data transmitted on the HTTPS connection. If you have more than 20 affected apps in your account, please check the Developer Console for a full list. To properly handle SSL certificate validation, change your code in the checkServerTrusted method of your custom X509TrustManager interface to raise either CertificateException or IllegalArgumentException whenever the certificate presented by the server does not meet your expectations. For technical questions, you can post to Stack Overflow and use the tags “android-security” and “TrustManager.” Please address this issue as soon as possible and increment the version number of the upgraded APK. Beginning May 17, 2016, Google Play will block publishing of any new apps or updates containing the unsafe implementation of the interface X509TrustManager. To confirm you’ve made the correct changes, submit the updated version of your app to the Developer Console and check back after five hours. If the app hasn’t been correctly upgraded, we will display a warning. While these specific issues may not affect every app with the TrustManager implementation, it’s best not to ignore SSL certificate validation errors. Apps with vulnerabilities that expose users to risk of compromise may be considered dangerous products in violation of the Content Policy and section 4.4 of the Developer Distribution Agreement. Apps must also comply with the Developer Distribution Agreement and Content Policy. If you feel we have sent this warning in error, contact our policy support team through the Google Play Developer Help Center. Regards, The Google Play Team
The missing part is the end: {noformat} ti.modules.titanium.network.NonValidatingTrustManager; {noformat} is the problem. BUT my apps compiled and uploaded after Nov'15 don't have the problem. So the solution could be just upload an update with the latest SDK. Also they don't say what will happen with the not-updated apps. They just say they won't allow apps/updates with the problem after May 17th.
Weird, we do throw the exception they ask for there: https://github.com/appcelerator/titanium_mobile/blob/bc85170157d3bebc5de1d61a9fe6e34bce84a8c9/android/modules/network/src/java/ti/modules/titanium/network/NonValidatingTrustManager.java#L24
Fokke That file is implementing checkServerTrusted but has no body so it would never actually throw the Exception.
In my playstore list I cannot see a rule which apps are evil or not. Apps without http client are good. But I have apps with a couple of SDKs and I have apps with http, self signed SSL and with "official" certs. In one app (that connects with a lot of https servers and use property 'validatesSecureCertificate : false,') is marked as 'good'. In warning on playstore I read 'apache'. Is the problem depending on server implementation?
What SDK versions are being used in the apps that get the warning?
[~titanium@webmasterei-hamburg.de] Is it possible to list which version of the Titanium SDK you are using for that?
This I can see: apps without http(s) and apps compiled with SDK5.1.2.GA seems to be OK warnings. Today I will test more apps.
We can no longer to use self-signed certificates in production?
You by using 'validatesSecureCertificate : false,'
[~falko] Will get that investigated as well as part of this ticket. Thanks for bringing up this concern.
Adding this blog post link http://www.appcelerator.com/blog/2016/02/google-security-alert-unsafe-implementation-of-the-interface-x509trustmanager/ if someone finds this ticket and needs information.
_"I think it makes good sense to have earlier SDKs available with a patch for the X509TrustManager to allow those not yet able to move up the ability to still resubmit apps to the store."_ It is a sentence from Malc Hollingsworth and I agree with him. Big or small may require staying on specific SDK versions for reasons outside of the wish for new features. Sometimes it is module compatibility or too many people working on a project part way through for a jump to newer SDKs. So a patch on all SDKs (or at least from 3.5.0, the most stable and used I think) woulf be a great idea.
[~mcvendrell] We are looking into patch versions of earlier SDKs as well. Titanium 3.5.1 currently is the [lowest supported version](http://docs.appcelerator.com/platform/latest/#!/guide/Titanium_Compatibility_Matrix-section-29004837_TitaniumCompatibilityMatrix-SupportedSDKReleases) but that ends in April (one year in).
(duplicate)
[~fokkezb] 3.5.1 stopped being supported a year ago. That document is out of date. We officially support the last major version for a year after release of the next major version. I would like to reiterate that this is a somewhat unique case in that this prevents you from uploading updates and new apps that flag this warning. I would liken this similarly to when Apple required all apps support 64-bit, and that required a SDK update for all iOS apps, not just Titanium ones. There are many, many reasons why an app should move to a newer SDK. That said, I would like to make this process as painless for as many people as possible.
TiSDK 5.0.2.GA was the last version that worked for me. 5.1.x+ introduced bugs that made our apps unusable. I haven't looked at any of the more recent releases, but my confidence is not particularly high that it won't require a ton of effort. Back porting to the 5.0.x branch would be ideal for me.
[~iotashan] which bugs are those so I can confirm they are fixed now?
I don't recall exactly off the top of my head. Seemed like there was something about ListViews, and something about collections. I know, I'm not being helpful. :(
[~ingo] With all due respect this is nothing like the iPhone 64 bit situation. When Apple announced that iOS was going moving to 64 bit it was due to Apple requirement and the betterment of the platform and a healthy lead time. This problem is nothing to do with Google and appears entirely based on an Appcelerator based issue. Guessing the Enterprise customers will jump for joy when they hear no back port update for 3.5.1. To be clear the 3.5.1 issue does not affect me, I am already transitioning the last projects to newer SDKs for entirely unrelated reasons. But I am smart enough to know that there are large projects out there that still require it. For many the move to 4.x was hampered by constant reports of problems with each release so many avoided it. This made the jump to 5.x a bigger one and for some the scale of the change midway through a large project is like asking a fuel tanker to stop and turn. This screams more like a bug fix - unintended as it might be.
I'd just like to add at least one more voice in support of the request to add the patch to 3.5.1. We have dozens of apps out there that are still running successfully on that version, and have not needed to be upgraded since publishing (though still get regular content updates). There are multiple external modules involved, and forcing them up to version 5.x just to deal with this (I hope) small issue would be a huge commitment we'd like to avoid. Thank you! David
Hi, I would also like to ask for a patch for 3.5.1 - We need to keep using 3.5.1 as we need to keep supporting very old versions of Android as a big chunk of our users (China userbase) are still using older versions of Android.
+1 for 3.5.1
Hello, we also have a few dozen apps released which receive regular updates but have been restricted from upgrading past 3.5.1 as well due to mostly Android compatibility issues. While we have slated a transition to 5.x, it would be very helpful to have a patch for 3.5.1 instead of forcing an accelerated transition.
@ingo I updated a couple projects to 5.2.0.v20160216202526 and don't seem to have any issues right now.
Is it solved at Ti SDK 5.2.0??? (Today update)
[~amurcia] thanks for the heads-up. I've added a note to the announcement I just published to say that 5.2.0.GA does not contain a fix for this issue yet: http://www.appcelerator.com/blog/2016/02/ga-release-of-cli-5-2-titanium-5-2-and-studio-4-5/
master PR: https://github.com/appcelerator/titanium_mobile/pull/7772
i think simple fix is to make validatesSecureCertificate : true in your http client, because it false by default. Default: False when running in the simulator or on device in testing mode, and true if built for release in distribution mode. many developers use the apk from test environment and forgot to change environment to production when they were uploading it to google play. hope it helps
[~David.Loekito] The problem is not the actual use of the class (the property being true or false) but the presence of the class. Our fix is removing that class.
[~hpham] we should add a deprecation notice to
getValidatesSecureCertificate
so that we can remove it in 6.0Not trying to make this more complicated, but figured I'd provide some information from my experience and an email exchange I had with google dev support in case it helps. In parallel with this thread, I had emailed their dev support to understand whether they detect using the class or simply having it. Her answer was a little vague (see below), however she also said to me that my latest app APKs have "fixed the problem" and I can ignore the warnings for past versions. That was interesting to me. We have a few different apps, but they are all branded versions of the same code base. The fundamental difference between the ones that got flagged and the ones that are now "fixed" is that we are now using SDK 5.1.0 while the previous builds were built with SDK 3.5.1. No changes to deploytype and we have never used the validatesSecureCertificate setting. I think above that a few others have noted some similar results with 5.x SDKs. I really don't know why the newer SDK makes a difference based on what I see in the SDK code, but it does appear to. I understand that this doesn't help those that don't want to move to SDK 5 for whatever reason, but it's another data point nonetheless. My exchange with Google:
Is there any chance that Appcelerator can provide a PR to backport this change to the 3.5.1 Branch? If that pull request can be provided with the conflicts resolved then we can take on the effort to build a custom 3.5.1 TiSDK to resolve this in the short term for our customers. Looking to move to 5.x in the future. Thanks!
[~tcrist], yes it should be no problem to patch and custom build older SDKs that we don't do a patch release for.
Just a feedback regarding Apps on Play store. I am having more than 150 apps on play store and i am getting above warning that after May 17th 2016 Google will block such apps. So my question is that only new apps and updates of existing apps on play store will require to be Secure other than that the current working apps need not to be updated before 17th, please correct me if i am wrong. Or is it like we need to update each and every app which is on play store before May 17th 2016. Thanks Bhavin
[~bhavin2887] Google [says](https://support.google.com/faqs/answer/6346016): {quote}Beginning May 17, 2016, Google Play will block publishing of any *new apps or updates* containing the unsafe implementation of the interface X509TrustManager.{quote} So existing apps should not have a problem until they need an update.
@Fokke Zandbergen {quote} Travis Crist, yes it should be no problem to patch and custom build older SDKs that we don't do a patch release for. {quote} I was wondering if Appcelerator could provide a properly merged PR to the 3.5.1 TiSDK. Right now as implemented the PR has merge conflicts with the 3.5.1 TiSDK. I would really like to have the expertise of an Appcelerator engineer to merge and resolve these conflicts since its in the http client which is a core class to app communication. Is it possible for Appcelerator to provide this PR but not the actual SDK so that those of us who need to add support for 3.5.1 have a clean merge to use for a custom TiSDK build. Thanks!
[~hpham] can you please provide this backport?
3.5.X backport: https://github.com/appcelerator/titanium_mobile/pull/7789
I see we can't more use self signed certificates in production since this PRs.
you can switch of this validation.
I can't turn it off due: https://github.com/appcelerator/titanium_mobile/pull/7789/files#diff-1e01f142e85df58a3e89a93008e5a21eR552
Misunderstanding I think. In my last project (Freifunker) the app is connected with a couple of servers, the most of it are unofficial SSL certs . validatesSecureCertificate : false, switches off the validation, it is unsecure (I know), but ist works. The server only sends public information.
Guys, what happens if I submit an app with newest SDK and validatesSecureCertificate : false? Will Google reject it? I saw a lot of deprecated code in the documentation without any direction I should follow =/
It will *not* rejected.
All, we have tested (submitted APKs for) a bunch of scenarios and our current findings are that for: * Titanium SDK 5.2.0.GA and 5.1.2.GA you are good with the defaults (target API level 23), regardless of whether you do development or production
deployType
and usevalidatesSecureCertificate
to disable validation or not. * Titanium SDK 5.0.2.GA you are good if you [manually](http://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference-section-29004921_tiapp.xmlandtimodule.xmlReference-SetatargetorminimumSDKlevel) target API level 22. * Titanium SDK 4.1.1.GA, 4.0.0.GA and 3.5.1.GA requires the patch in the [pending PR](https://github.com/appcelerator/titanium_mobile/pull/7789), which also means you can not usevalidatesSecureCertificate:false
anymore. Please help us confirm these findings by uploading (no need to publish) an APK using the above configurations and wait for at least 5 hours. Keep a copy of the build log and if you *do* get a security alert, please send the build log to us. Will wait this out for a few days and then confirm our findings in a follow up blog post. Again we want to emphasis that unless you usevalidatesSecureCertificate:false
there is no actual security issue. It's just that Google decided to warn for an unsafe class even if its not actually used. *Updated March 7:* New info on <= 4.1what about 5.0.2 ?
[~rborn] seems to be good with target API level 22. Could you try and confirm? We'll do some additional tests in the coming days.
Thanks, I'll try
Would love to try the [Pending PR 7789](https://github.com/appcelerator/titanium_mobile/pull/7789) by Hieu in my 3.5.2XXX android SDK. I remember that with IOS code modifications I was able to navigate and update the source inside the '~/Library/Application Support/Titanium/mobilesdk/XXX_VERSION/iphone' folders. (?) I'm curious how I could do this with [Hieu's 3.5.X Pending PR7789](https://github.com/appcelerator/titanium_mobile/pull/7789) ? Or should I clone & build a custom build? Happy to test it out and publish to Google Beta Store and publish my findings. kind regards, Roeland
[~rpl] For Android you indeed need to do a [Custom Build](http://docs.appcelerator.com/platform/latest/#!/guide/Building_the_Titanium_SDK_From_Source) or wait for the PR to be merged and included in the next [Nightly Build](http://builds.appcelerator.com/).
@fzandbergen, can we assume your findings mean 4.1.1 and below, or is there any separate guidance for 4.1.0.GA? Thanks.
[~blankenshipb] I've only tested the latest of each minor. Any specific reason you need 4.1.0 instead of 4.1.1?
@fzandbergen, yes, a customer. On a side note, another customer is on 5.0.2.GA, did not set the Android API level to 22 (it was set at 21), yet did not receive the warning.
That's great news on the API level [~blankenshipb], thanks.
@fzandbergen, I just saw the blog post, and as mentioned yesterday, and per your request in the blog, we do see the issue in 4.1.0.GA. Please advise.
All, we have a new blog post with an update on this issue: http://www.appcelerator.com/blog/2016/03/update-on-recent-google-security-alerts/
[~blankenshipb] That you see the issue in 4.1.0.GA is in line with [our findings](http://www.appcelerator.com/blog/2016/03/update-on-recent-google-security-alerts/#we). Please upgrade to 5.x or use a CI or custom build of an older SDK with the patch linked from the blog post.
Fixes have been done to branches 3_5_X, 4_0_X and 4_1_X. Along with fixes TIMOB-20534 that was required. Resolving this issue.
Cleaning up older fixed tickets from 2016 and earlier. If this ticket should not have been closed, please reopen it.