LWN.net Logo

Security

Password storage on Android devices

August 3, 2011

This article was contributed by Nathan Willis

A number of Android device owners are upset to learn that their trusty products store sensitive credentials — such as email account passwords — in plain text. The bug tracker entry has amassed an impressive number of votes, but as the attached discussion reveals, any proposed solution butts up against consumers' conflicting expectations — such as that the device continue to check for messages as long as it is turned on, yet never inconvenience the user by demanding a password.

The root of the trouble is that POP, SMTP, IMAP, and other email protocols may require the client to provide the account password on every connection attempt. Thus, in order for the phone to check email silently in the background, the OS must have access to the password in plaintext. Google's default email application does just this, storing account passwords in the clear inside a SQLite database. Google's Gmail-specific client application, which uses a different, token-based authentication protocol, does not require the password on each connection, but the token itself may serve just as well. Discovery of that password "flaw" spawned a tremendous public outcry in the comments section of Android bug #10809.

Of course, Android is not alone in this regard. Apple's iOS and other mobile platforms also store passwords on the device in plain text, and a client application on any other computing platform faces the same challenge: Thunderbird, PINE, Evolution, KMail, etc. — even IM clientsall send the account password to the server when left running unattended. Consequently, they must either store the password in plain text, ask for it on every connection attempt, or encrypt it and require the user to enter a different passphrase to unlock the storage location.

Analyzing the problem

The difference is that mobile phone users are unaccustomed to logging into their phones with a username and password, and even if they do, they tend to leave their phones on (and thus leave themselves "logged in") 24 hours a day. A password store decrypted at login time would be readily available to a pickpocket, even if it is stored securely when the phone is deactivated. The pickpocket attack reveals another challenge to mobile password security: there is a difference between security measures that protect user credentials on "disk" when the phone is off, and measures that protect the credentials during an active session.

Android will be implementing its own form of full-disk encryption with 3.0 ("Honeycomb"), which will offer protection against extracting information from the flash storage card. But this will not help any users on earlier versions of Android, nor does it protect against attackers who steal running phones.

Google cannot force third-party application developers to store passwords wisely, but many commenters on bug 10809 feel that the company ought to provide a more secure option for the set of default Android applications. The discussions on the bug tracker and on external sites like Android Central make for interesting reading.

Some suggested encrypting (or obfuscating) the password file itself, and storing the key to that file elsewhere, such as on a "keychain" stored on the device. But as Android developer Andy Stadler pointed out, this does not improve security, it only moves the weak link to a different file. The password safe must be decrypted for the application to use it, which means the password to the password safe must itself be stored in plain text for unattended access. As he put it, there is "a simple test: if you can boot up the device and it will begin receiving email on your configured accounts, then the passwords are not truly secure. They are either obfuscated, or encrypted with another key stored somewhere else."

Others suggested not storing the passwords locally at all, but storing only a hash of the password instead. This approach does not work either, as user hyperhacker noted, because hash functions are one-way, and the original password is what must be sent to the server. Thus in practice either the user will be prompted for the password to validate the hash value (in which case the stored hash is clearly useless), or else the "hash" function is actually an encryption function, and the scheme is no different from the other encrypt-the-password-file proposals mentioned above.

Inconvenient security

The "executive summary" of the situation is that either the OS has access to a password in plaintext without user intervention, or else the user must be prompted to supply a password that is stored nowhere on the device. The real question is how much inconvenience the user will tolerate.

A scheme that asks the user for a boot-time passphrase to unlock a password safe is not very secure because of how long phone sessions typically last. As user mahashel put it in a related bug report:

The trick with phones is that they are powered on for great lengths of time. Once the User logs into the device the filesystem is visible/decrypted, and it remains that way until powered down. How may people power down their phones before they lose them? ;)

One alternative would be to re-prompt the user for a passphrase whenever the device is awakened from an idle or sleep state. User aigarius argued that this would prevent the device from checking email in the background. "If you 'tie' it to the unlock code, then you can only check the email when the phone is unlocked, which is clearly quite useless." This is not true in the strictest sense: the OS could "forget" the password only when the user begins the unlock procedure — that way the background process could continue to check messages and activate alerts, and a pickpocket would still be locked out — but it still requires the user to enter a passphrase, PIN code, gesture, or some other form of credential every time he or she picks up the phone to do anything. That level of inconvenience seems to be anathema to most consumers.

User solinym suggested biometrics might be better received among consumers than passwords, with a caveat: "If you think key rotation is a PITA, you haven't tried replacing your fingerprints." He also raised the question of hardware security, tamper-resistance in particular, suggesting that the hardware required to prevent hardware key-extraction would add little to the cost of modern smartphones.

Gertvdb suggested storing a "master password" on the phone's SIM card, because SIM cards are more secure by default, they limit the number of attempts to enter the PIN code, and they have storage capacity. "The phonebook / SIM SMS message store should have enough space, even on 8k SIM cards. (And doesn't seem to be used by Android) (Some compression might make sense, to reduce the amount of storage needed)." Of course, not all phones use SIM cards, and on those that do, denial-of-service is a risk, as an attacker (perhaps a casual one just snooping around) could exceed the allowed number of PIN guesses and lock out the phone owner, even if they do not gain access to the data on the device.

As is typical of security debates, the talk returned time and time again to whether or not providing some form of weak security was worthwhile (to prevent casual attackers), or whether, in the absence of a foolproof solution, all other solutions give users a "false sense of security" and are "a complete waste of time" for developers to attempt.

Eventually a number of suggestions arose that amount to offering user-selectable "security levels," through which security-conscious users could enable strong encryption of their credentials at the cost of automated access, and the more laissez-faire could dispense with it. User danthanos called for a public API providing a secure storage service:

This service could be offered as an API to any Android app including the mail application. In future this API could make automatic use of any h/w based secure storage for key materials and credentials. Most of the fundamental crypto methods and needed software libraries exist to implement a service of this nature.

Tangential issues

Google has not responded with a game plan. Stadler, who marked the bug as "medium" importance last September, also commented "rest assured, I am not closing this bug. We recognize that this is causing concern for some users, and we're going to look at identifying steps that can make your data more secure" — which remains the last public word on the subject from the Android team.

The full-disk encryption debuting in Honeycomb is unquestionably a step in the right direction, because it does offer protection against exposing one's password in the event of a memory card theft. Intriguingly enough, however, another commenter reported that Android already has an internal "Credential Storage" API that is not documented for public use. Several third-party Android discussion forums have also brought up this API, so it appears to be in the wild already, but there is no official discussion of it. It appears to be used by applications for storing VPN certificates and other credentials not chosen by the user, but without a published API it is not likely to be useful to developers (and abusing it may break important things as well).

Android does have a "remote wipe" function (as asked about by hyperhacker in the bug discussion thread) for administrators to activate in case of theft, although it must be set up in advance. Needless to say, a remote wipe is hit-or-miss: if activated before an attacker accesses the phone, it works, if activated afterward it does no good at all. Remote wipe can also be used in ways that users may not expect.

In the meantime, security-focused users and developers can always turn towards third-party Android Market tools to offer additional layers of protection. There are stand-alone applications for bulk password storage, although these do not automatically sign-in to email (or other services). There are applications that provide password-protected access to the application as a whole, and there are PGP clients and directory encryption utilities galore. Even with all of those add-ons activated, however, it will still be up to the user to make the final choice: would you rather have your phone check your email in the background (and store your account password in plaintext), or have your phone keep your password safe (and force you to supply a password for access). There's just no way to have it both ways.

Comments (18 posted)

Brief items

Security quotes of the week

In a move that seems Big Brother-ish, Apple has a patent in the works that could use voice and facial recognition technology to activate a "kill switch" on its popular iPhone, shutting it down when hackers "jailbreak" or unlock the phone to install unauthorized programs on it, or try to steal information from an unsuspecting iPhone user.
Apparently the FBI doesn't quite recognize that "Big Brother" is the government.
-- Mike Masnick notes a lack of irony detection at the FBI

Although these tools need to be created by competent people, they are intended for mass use (point and click) and so copyright infringement by the masses will always be easy. They will not even know that the hurdles were there, because the tools will jump over them.

Fortuitously, the DCMS have provided an illustration of this in their publishing of the OFCOM report...

[...] What the DCMS [Department for Culture Media and Sport] have done (following in the footsteps of many other incompetents) is to black out the text they consider to be sensitive. Removing this blacking out is simple but tedious ... you can get out a copy of Acrobat and change the text colour to white — or you can just cut and paste the black bits into Notepad and see the text.

-- Richard Clayton reports on the ineffective blocking in a "Site Blocking" report

ShareMeNot is a Firefox add-on designed to prevent third-party buttons (such as the Facebook "Like" button or the Twitter "tweet" button) embedded by sites across the Internet from tracking you until you actually click on them. Unlike traditional solutions, ShareMeNot does this without completely removing the buttons from the web experience.
-- ShareMeNot

Comments (1 posted)

WASP: The Linux-powered flying spy drone that cracks Wi-Fi & GSM networks (Geek.com)

Geek.com takes a peek at the Wireless Aerial Surveillance Platform (WASP), which is a repurposed US Army unmanned aerial vehicle (UAV or drone) outfitted to intercept WiFi and GSM. It will be demonstrated at the upcoming Black Hat and DEFCON security conferences. "If you happen to see this yellow drone flying above your neighborhood you’d be right to be concerned. WASP is equipped with the tools to crack Wi-Fi network passwords made possible by an on-board VIA EPIA Pico-ITX PC running BackTrack Linux equipped with 32GB of storage to record information. BackTrack offers a full suite of digital forensics and penetration testing tools making it a good fit for this setup. [...] WASP can also act as a GSM network antenna meaning it will be able to eavesdrop on calls/text messages made over that network by any phone deciding to connect through it."

Comments (none posted)

New vulnerabilities

clamav: denial of service

Package(s):clamav CVE #(s):CVE-2011-2721
Created:July 28, 2011 Updated:November 7, 2011
Description:

From the Ubuntu advisory:

It was discovered that the hash processing code in libclamav improperly handled messages with certain hashes. This could allow a remote attacker to craft a document that could cause clamav to crash, resulting in a denial of service.

Alerts:
Fedora FEDORA-2011-15119 2011-10-29
Fedora FEDORA-2011-15076 2011-10-29
Gentoo 201110-20 2011-10-23
openSUSE openSUSE-SU-2011:0940-1 2011-08-24
Fedora FEDORA-2011-10053 2011-08-02
Fedora FEDORA-2011-10090 2011-08-02
Mandriva MDVSA-2011:122 2011-08-13
Pardus 2011-106 2011-08-08
Ubuntu USN-1179-1 2011-07-28

Comments (none posted)

erlang: predictable seeds used for random number generation

Package(s):erlang CVE #(s):CVE-2011-0766
Created:August 1, 2011 Updated:November 26, 2012
Description: From the CVE entry:

The random number generator in the Crypto application before 2.0.2.2, and SSH before 2.0.5, as used in the Erlang/OTP ssh library before R14B03, uses predictable seeds based on the current time, which makes it easier for remote attackers to guess DSA host and SSH session keys.

Alerts:
Fedora FEDORA-2011-9657 2011-07-23
Fedora FEDORA-2011-9598 2011-07-23
Mageia MGASA-2012-0338 2012-11-23

Comments (none posted)

foomatic: arbitrary code execution

Package(s):foomatic CVE #(s):CVE-2011-2697
Created:August 1, 2011 Updated:September 23, 2011
Description: From the Red Hat advisory:

An input sanitization flaw was found in the foomatic-rip print filter. An attacker could submit a print job with the username, title, or job options set to appear as a command line option that caused the filter to use a specified PostScript printer description (PPD) file, rather than the administrator-set one. This could lead to arbitrary code execution with the privileges of the "lp" user.

Alerts:
CentOS CESA-2011:1109 2011-09-22
Ubuntu USN-1194-1 2011-08-22
Mandriva MDVSA-2011:125 2011-08-14
CentOS CESA-2011:1109 2011-08-14
openSUSE openSUSE-SU-2011:0892-1 2011-08-12
Scientific Linux SL-foom-20110801 2011-08-01
Red Hat RHSA-2011:1109-01 2011-08-01
Debian DSA-2380-1 2012-01-04
Gentoo 201203-07 2012-03-05

Comments (none posted)

foomatic: arbitrary code execution

Package(s):foomatic CVE #(s):CVE-2011-2964
Created:August 2, 2011 Updated:August 22, 2011
Description: From the Scientific Linux advisory:

An input sanitization flaw was found in the foomatic-rip print filter. An attacker could submit a print job with the username, title, or job options set to appear as a command line option that caused the filter to use a specified PostScript printer description (PPD) file, rather than the administrator-set one. This could lead to arbitrary code execution with the privileges of the "lp" user.

Alerts:
Ubuntu USN-1194-1 2011-08-22
Fedora FEDORA-2011-9575 2011-07-22
Fedora FEDORA-2011-9554 2011-07-22
Mandriva MDVSA-2011:125 2011-08-14
openSUSE openSUSE-SU-2011:0892-1 2011-08-12
Red Hat RHSA-2011:1110-01 2011-08-01
Scientific Linux SL-foom-20110801 2011-08-01
Debian DSA-2380-1 2012-01-04
Gentoo 201203-07 2012-03-05

Comments (none posted)

kernel: multiple vulnerabilities

Package(s):kernel CVE #(s):CVE-2011-1479 CVE-2011-1927 CVE-2011-2484 CVE-2011-2493 CVE-2011-2495 CVE-2011-2498
Created:August 2, 2011 Updated:September 14, 2011
Description: From the openSUSE advisory:

CVE-2011-1479: A regression in inotify fix for a memory leak could lead to a double free corruption which could crash the system.

CVE-2011-1927: A missing route validation issue in ip_expire() could be used by remote attackers to trigger a NULL ptr dereference, crashing parts of the kernel.

CVE-2011-2484: The add_del_listener function in kernel/taskstats.c in the Linux kernel did not prevent multiple registrations of exit handlers, which allowed local users to cause a denial of service (memory and CPU consumption), and bypass the OOM Killer, via a crafted application.

CVE-2011-2493: A denial of service on mounting invalid ext4 filesystems was fixed.

CVE-2011-2495: The /proc/PID/io interface could be used by local attackers to gain information on other processes like number of password characters typed or similar.

CVE-2011-2498: Also account PTE pages when calculating OOM scoring, which could have lead to a denial of service.

Alerts:
Oracle ELSA-2011-2037 2011-12-15
Red Hat RHSA-2011:1813-01 2011-12-13
Ubuntu USN-1285-1 2011-11-29
Ubuntu USN-1281-1 2011-11-24
Ubuntu USN-1279-1 2011-11-24
Ubuntu USN-1256-1 2011-11-09
Ubuntu USN-1245-1 2011-10-25
Ubuntu USN-1244-1 2011-10-25
Ubuntu USN-1243-1 2011-10-25
Ubuntu USN-1242-1 2011-10-25
Ubuntu USN-1241-1 2011-10-25
Ubuntu USN-1240-1 2011-10-25
Ubuntu USN-1239-1 2011-10-25
Scientific Linux SL-kern-20111020 2011-10-20
Ubuntu USN-1236-1 2011-10-20
CentOS CESA-2011:1386 2011-10-21
Red Hat RHSA-2011:1386-01 2011-10-20
Scientific Linux SL-kern-20111005 2011-10-05
Red Hat RHSA-2011:1350-01 2011-10-05
Ubuntu USN-1218-1 2011-09-29
Ubuntu USN-1216-1 2011-09-26
CentOS CESA-2011:1212 2011-09-22
Debian DSA-2310-1 2011-09-22
Ubuntu USN-1212-1 2011-09-21
Ubuntu USN-1208-1 2011-09-14
Ubuntu USN-1205-1 2011-09-13
Ubuntu USN-1204-1 2011-09-13
Ubuntu USN-1203-1 2011-09-13
Ubuntu USN-1202-1 2011-09-13
Ubuntu USN-1253-1 2011-11-08
Ubuntu USN-1201-1 2011-09-13
Red Hat RHSA-2011:1253-01 2011-09-12
Debian DSA-2303-2 2011-09-10
Scientific Linux SL-kern-20110906 2011-09-06
Debian DSA-2303-1 2011-09-08
Red Hat RHSA-2011:1212-01 2011-09-06
SUSE SUSE-SU-2011:0984-3 2011-09-02
SUSE SUSE-SU-2011:0984-2 2011-09-02
SUSE SUSE-SA:2011:038 2011-09-01
Scientific Linux SL-kern-20110823 2011-08-23
Red Hat RHSA-2011:1189-01 2011-08-23
Fedora FEDORA-2011-11103 2011-08-18
Ubuntu USN-1193-1 2011-08-19
SUSE SUSE-SU-2011:0899-1 2011-08-12
SUSE SUSE-SA:2011:034 2011-08-12
Ubuntu USN-1186-1 2011-08-09
openSUSE openSUSE-SU-2011:0861-1 2011-08-02
openSUSE openSUSE-SU-2011:0860-1 2011-08-02
Ubuntu USN-1379-1 2012-02-28
Ubuntu USN-1380-1 2012-02-28
Ubuntu USN-1383-1 2012-03-06
Ubuntu USN-1386-1 2012-03-06
Ubuntu USN-1387-1 2012-03-06
Ubuntu USN-1394-1 2012-03-07
Oracle ELSA-2012-0150 2012-03-07

Comments (none posted)

libsoup: directory traversal

Package(s):libsoup CVE #(s):CVE-2011-2524
Created:July 29, 2011 Updated:March 23, 2012
Description:

From the Red Hat advisory:

A directory traversal flaw was found in libsoup's SoupServer. If an application used SoupServer to implement an HTTP service, a remote attacker who is able to connect to that service could use this flaw to access any local files accessible to that application via a specially-crafted request. (CVE-2011-2524)

Alerts:
Debian DSA-2369-1 2011-12-21
Fedora FEDORA-2011-9820 2011-07-31
Pardus 2011-108 2011-09-05
Fedora FEDORA-2011-9763 2011-07-31
Ubuntu USN-1181-1 2011-07-28
Scientific Linux SL-libs-20110728 2011-07-28
Red Hat RHSA-2011:1102-01 2011-07-28
openSUSE openSUSE-SU-2011:0875-1 2011-08-05
Mandriva MDVSA-2012:036 2012-03-23

Comments (none posted)

libwebkit: arbitrary code execution

Package(s):libwebkit CVE #(s):CVE-2011-1774
Created:August 2, 2011 Updated:August 3, 2011
Description: From the CVE entry:

WebKit in Apple Safari before 5.0.6 has improper libxslt security settings, which allows remote attackers to create arbitrary files, and consequently execute arbitrary code, via a crafted web site. NOTE: this may overlap CVE-2011-1425.

Alerts:
SUSE SUSE-SU-2011:0857-1 2011-08-02

Comments (none posted)

mapserver: SQL injection

Package(s):mapserver CVE #(s):
Created:August 2, 2011 Updated:August 21, 2012
Description: MapServer versions 4.x, 5.x and 6.x are potentially vulnerable to SQL injection, particularly if OGC protocols are enabled and with layers connecting to an SQL RDBMS backend, either natively or via OGR. See the MapServer advisory for details.
Alerts:
Fedora FEDORA-2011-9555 2011-07-22
Fedora FEDORA-2011-9517 2011-07-22
Mageia MGASA-2012-0230 2012-08-21

Comments (none posted)

selinux-policy: unspecified vulnerabilities

Package(s):selinux-policy CVE #(s):
Created:August 2, 2011 Updated:August 3, 2011
Description: From the Scientific Linux advisory:

These updated selinux-policy packages include a number of bug fixes and enhancements. Space precludes documenting all of these changes in this advisory.

Alerts:
Scientific Linux SL-seli-20110721 2011-07-21

Comments (none posted)

Page editor: Jake Edge
Next page: Kernel development>>

Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds