views:

137

answers:

4

I've inherited a mobile app which sends auth credentials (userid/password) in the clear.

I'd imagine that I have 2 choices: a) use TLS. b) write my own auth protocol.

If I choose (b) what are the key guidelines that I must follow to make it it secure. e.g. how to avoid replay attacks, encryption strategies. Thanks

+3  A: 

If you use b), the key guidelines are: Don't. If you want it secure, that is.

Try to stick with a).

Tomalak
I haven't looked at the new phones, but I had some problems with the installed SSL certs before.
Jacques René Mesrine
A: 

For (b) I guess you do a challenge-response thingy.

Server generates a random string, sends it to the client. Client appends it to the password and hashes the whole thing, sends the hash back to the server. Server does the same calculation, compares the result with what it got from the client. If they match then the client sent the correct password.

The most obvious vulnerability is that if someone snoops both sides of the exchange, they can then run an offline dictionary attack against the password.

A: 

For both "you can't get sued for it" and "reasonably protected" definitions of 'safe', for a mobile application, you can assume that the line is secure vs man-in-the-middle attacks and wide open to eavesdropping. SSL/TLS sounds the easiest way to go, but this might depend on your carrier and target phones.

If you can't make TLS work and you need to roll your own, use Diffie-Hellman key exchange and established crypto library (Legion of the Bouncy Castle have a jightweight implementation that is J2ME compliant.)

ddimitrov
Yes my mobile app is J2ME. And yes, I've had prior problems with SSL. Thanks.
Jacques René Mesrine
Why is the line secure against man-in-the-middle attacks?
Alexander
The line is assumed to be secure as mounting man-in-the-middle attack by a third party requires inserting a proxy cell in the network. It's considerable amount of work and relatively easy to detect by the carrier. I'm assuming that the carrier is a trusted third party as they have your data anyway.
ddimitrov
Do you really trust your carrier (e.g., their employees, them not relaying your data to various agencies)? Even if you do, what about the next leg of the journey: carrier -> Internet -> target server? I wouldn't discount proxy/relaying cell towers, and rogue WiFi LANs either.
Alexander
Nope, I don't trust them this much, but my employer sure as hell does. In the end trust in business is not about good and evil, it's about covering ones ass. The carrier is (usually) contractually obliged to guarantee your data integrity. Same for the big telcos.
ddimitrov
+1  A: 

Writing your own security protocol is not necessary, and a bad idea. It will almost definitely have exploitable flaws. If all you need is to protect the confidentiality of the login credentials, then SSL/TLS is what you should use. It also allows you to more easily upgrade to client certificate-based authentication in the future.

Eugene