Thousands of secret keys found in Android apps
cnet.com
cnet.com
So, now you have those keys. What are you going to do with them? Just because you have the "app" key doesn't mean you have access to any sort data. The worst you can do is write an authentication flow with some other companies app keys, and then what?
Can someone please explain what the security issue here is?
(Of course there might be some APIs that allow doing more by interacting with them directly than what the app originally allowed, but I think those are just cases of bad design.)
Some of them also have a HTML5-App (with a wrapper) available for Android. This app uses the same API.
So some malicious developer could just unzip the app, read the JavaScript and find the API-key, and use their key instead of paying for one.
And as the website usually has many accesses from the same IP (due to mobile users being behind NATs), the Website will never find out that someone is abusing their API.
There are suggestions in comments here that you hide your third party API keys in your own backend server, and your app queries for the API keys and then makes the call from the client using the temporary downloaded keys.
So how do you secure your own server's API keys? That's just a Russian doll implementation.
I can't see a valid way to access an API key using a consumer key / secret without storing them in the application.
Any suggestions?
To avoid the need of storing secret tokens on a mobile device, Facebook
leverages the presence of the official Facebook Android application on
Android devices. The Facebook SDK allows third-party applications to use
Android intents to proxy requests for user access tokens through Facebook's
Android application, where the user is already authenticated. To retrieve a
user's access token with the Facebook SDK, the Android application identifier
of a third-party application must be registered on its Facebook application
settings page. This allows Facebook's Android application to respond to the
third-party application's access token request by verifying the application
identifier in the intent to the one officially registered online. Only the
application identifer is needed and no secret key is compromised since it
is retrieved at runtime. This technique relies on the robustness of Android
since the source of the Android intent is assumed not to be spoofable.
Does anyone have a clearer description of this process. I've now read this extract three times and I'm none the wiser.[1] http://www.cs.columbia.edu/~nieh/pubs/sigmetrics2014_playdro...
Because you've registered this information, Facebook will only allow your app to perform actions if it not only has the correct API key but also matches the registered details. I suppose this means that if someone decompiles your app and steals your key they can't perform actions pretending to be you.
*edit I mean it's not true that the attacker can't impersonate your app. Your description of how it works looks right on to me. :)
https://github.com/facebook/facebook-android-sdk/blob/master...
The process is described here: https://developers.facebook.com/docs/android/getting-started...
The Facebook app for Android is closed source; however, the Facebook Android SDK seems to verify requests from the Facebook app in a similar way: https://github.com/facebook/facebook-android-sdk/blob/master...
I imagine that it works like that the other way around as well: Check whether the code signature of the Intent's sender matches the app developer certificate.
I wonder in what circumstances the author thinks users can be 100% certain that the app they are downloading is entirely secure. Cause, yeah, there aren't any.
1. the user is side-loading an app they wrote themselves (or is an internal Apple/Google developer who uploaded an app to their app store and audited the entire sausage-making process as it transpired),
and 2. the app does literally nothing,
then the user can be 100 percent certain that the app does what it does securely.
The paper also says they found amazon tokens, with which you can spawn instances. I think you can use other kind of authentication that don't give access to the whole account.
I dunno. I've wondered about all this myself quite a lot, perhaps its a non-issue?
If you're shipping root account AWS keys in any app, you're doing it wrong.
Best writeup for Google I've found: http://www.riskcompletefailure.com/2013/10/google-android-cl... (author talks about "PlusClient" which is now deprecated in favor of "GoogleApiClient", but other than that, the article is accurate - but missing server-side details).
It's a lot harder. So I'm guessing many devs just skip it.
Ideally: either the service allows you to generate short-lived tokens (server-side, ideally without a request to the service), or you sign requests for the client. In the latter, you generally gain some measure control over what apps can do, with relatively small cost. Basically that's what you can do with S3 file uploads - your server can generate a signed URL, then the client can upload to it, all while you retain complete control of your API secrets.
Proxying all calls through our own server seems like an expensive way of solving this problem. Because if the client is compromised it doesn't do much anyway.
Its not just about moving keys out of the source, but about getting rid of local config files altogether. Related post on their blog: http://blog.keystok.com/why-i-stopped-using-local-config-fil...
Disclosure: I'm a developer at Keystok.
One solution would be for Apple and Android to have an "environment" section for applications. You'd be able to set these environment keys when publishing the app.
Apple and Android could provide an API to these environment keys, and they'd be published in an encrypted form as part of the application manifest.
Bonus Points: It would be relatively simple to provide the facility from the AppStore provider for changing / cancelling these keys.
https://github.com/search?o=desc&q=_CONSUMER_SECRET&ref=sear...
Also, scrambling function and variable names is always a good idea, it makes reverse engineering your app a lot harder. And there are many programs on the market that will do this for you automatically.