Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How safe are client SSL certificates in a mobile app?

I'd like to have secure communication between my Android/iOS app and my Internet-accessible backend service, so I'm investigating HTTPS/SSL.

If I create self-signed certificates, then put a client certificate in the app and cause the backend service to require that client certificate, is this truly secure?

Here's why I'm asking. It seems that the client certificate could be "hacked" by interrogating the .apk. The client certificate is just a string constant, right? That means anyone could use the client certificate to access my backend. Is the .apk (and iOS equivalent) sufficiently opaque to prevent the client certificate from being discovered?

like image 786
Jacob Marble Avatar asked Mar 18 '12 23:03

Jacob Marble


People also ask

Do mobile apps need SSL certificate?

Maybe this is because the browsers in many apps don't include indicators such as HTTPS, padlock, and the green address bar. But it doesn't take away from the fact that having SSL enabled is a must for Apps, be it any platform—Android or iOS.

Can a client certificate be stolen?

If the private key is also compromised, they can hack into the session encrypted using that particular private key eavesdrop on both client-server and server-client communication. Hackers can also sign malware using the stolen private key and inject it into systems, escaping detection.

Are client certificates secure?

A client certificate is used to authenticate the client or user identity to the server. Server certificates perform encryption on data-in-transit to assure data confidentiality. Client certificate does not encrypt any data, it only serves as a more secure authentication mechanism than passwords.

Are SSL certificates secure?

Companies and organizations need to add SSL certificates to their websites to secure online transactions and keep customer information private and secure. In short: SSL keeps internet connections secure and prevents criminals from reading or modifying information transferred between two systems.


2 Answers

Are you doing client side authentication with certificates over SSL? Not that it really matters for this question. Any private keys you store in your app is accessible to an attacker. Each client should have it's own certificate and key pair, to prevent a mass compromise. Your server should also enforce protections, ensuring a compromised client can't just request anything.

This is true for any authentication scheme. If you embed passwords, API keys, decryption keys, whatever. Anything on the device should be assumed to be accessible.

The added security from certificates in part comes from there being nothing to brute force. If you went the username/password route for each clients, passwords can be guessed. Same with API keys (albeit they are longer and harder). With certificates, it's an entirely different class of attacks, and a considerably harder problem.

But, most importantly, the backend service shouldn't allow the app to do anything it wouldn't normally do.

Now, dealing with certificates, you're going to have a whole host of other problems. You probably want to sign each client certificate with your self-signed CA cert. Managing that CA cert can be problematic, depending on your use case. Are you going to generate these client certs on the fly, or manually yourself? Meaning, is this an app that a million people can download, and you need an automated system for generating them? Or is this a private/internal app that you personally will handle generating certs?

like image 114
mfanto Avatar answered Oct 11 '22 02:10

mfanto


The certificate is harmless. It is the private key that needs protection, and it is only as safe as the device itself, no safer. Distributing the certificate and private key with the application just means that anyone who has the application has the key, so it doesn't provide you any security whatsoever. I think you need some kind of post-install registration step.

like image 35
user207421 Avatar answered Oct 11 '22 03:10

user207421