Credentials located in gnome-keyring can be compromised easily

Bug #1780365 reported by Seong-Joong Kim
270
This bug affects 4 people
Affects Status Importance Assigned to Milestone
gnome-keyring (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Dear all,

I figure out that login credentials, located in gnome-keyring, can be easily compromised.

Linux based on Gnome basically uses ‘gnome-keyring’ as their backend to store login credentials in a secure manner. Specifically, google-chrome browser, network-manager and gnome-online-accounts use this as a backend solution to store login credentials.

To use this, authentication is performed together with gnome-keyring as part of ‘pam-gnome-keyring.so’. At this point, it remains unlocked until system is shut down or logged out. In this state, a simple program that uses ‘Secret Service API’ call and their ‘D-Bus’ interface can easily retrieve login credentials from those gnome-keyring without any privilege escalation, listening into the X events going to another window, or installation an application on target computer.
(please check PoC source https://github.com/sungjungk/keyring_crack and video https://youtu.be/Do4E9ZQaPck)

The issue is different from the content shown on the Ubuntu Security FAQ and GnomeKeyring Wiki [1][2]. It was even said that “PAM session is closed via the screensaver, all keyrings are locked, and the ‘login’ keyring is unlocked upon successful authentication to the screensaver”. After trying to crack the keyring, it was far from what they really thought. It is no different than plain text file for login credentials somewhere on disk.

To deal with, the root cause of the problem is that ‘Secret Service API’ on anyone can be easily accessed on DBus API. If access control is enabled, only well-known? or authorized processes, such as google-chrome, network-manager, and gnome-online-accounts, will be able to access the login credentials.

DBus originally provides capability that is essential to access control of DBus API by defining security policy as a form of *.conf file. Currently, various services based on DBus interface are employing above security policy feature to perform access control. For example, login/system related functions is controlled from ‘login1’ and its security policy is described in “org.freedesktop.login1.conf”. (see https://github.com/systemd/systemd/blob/master/src/core/org.freedesktop.systemd1.conf)

Likewise, why don’t we try adopting the access control of secret service API into gnome-keyring environment?

Due to the fact that a process with root privilege can access “.conf” file, an approved program may only update the target file during installation process

Here is really simple ‘org.freedesktop.secrets.conf’ example.

=================================================================================
<?xml version="1.0"?> <!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
        "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<busconfig>
    <policy context="default">

        <deny receive_sender="*"
                    receive_interface="org.freedesktop.Secret.Item"
                    receive_member="GetSecret"/>

        <!-- allow access to seahorse application (formerly keyring manager) -->
        <allow receive_sender="org.gnome.seahorse.Application"
                    receive_interface="org.freedesktop.Secret.Item"
                    receive_member="GetSecret"/>

        <!-- allow access to network-manager -->
        <deny receive_sender="org.freedesktop.NetworkManager"
                    receive_interface="org.freedesktop.Secret.Item"
                    receive_member="GetSecret"/>

        <!-- allow access to gnome-online-accounts -->
        <deny receive_sender="org.gnome.OnlineAccounts"
                    receive_interface="org.freedesktop.Secret.Item"
                    receive_member="GetSecret"/>
    </policy>
</busconfig>
=================================================================================

Many Thanks!!

[1] https://wiki.ubuntu.com/SecurityTeam/FAQ#Contact

[2] https://wiki.gnome.org/Projects/GnomeKeyring/SecurityPhilosophy

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gnome-keyring 3.28.0.2-1ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Thu Jul 5 17:45:22 2018
InstallationDate: Installed on 2018-07-06 (0 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gnome-keyring
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Seong-Joong Kim (sungjungk) wrote :
description: updated
information type: Public → Private Security
Revision history for this message
Sebastien Bacher (seb128) wrote :

The issue looks similar to the well known https://bugzilla.gnome.org/show_bug.cgi?id=551036

Revision history for this message
Sebastien Bacher (seb128) wrote :

or bug #189774 in launchpad

Revision history for this message
Seong-Joong Kim (sungjungk) wrote :

I know about that, but the problem is more serious than what I initially thought.
Existing issues have focused primarily on the behavior of seahorse and simply expect to prompt for a password before displaying a key’s plaintext password.
Moreover, countermeasures in Ubuntu Security FAQ is not appropriate for the problem and it doesn’t work like that.
The underlying problem has not been solved yet.

Instead, I would like to propose a different method by using access control scheme provided by DBus internal. Existing other services based on DBus are already taking advantage of the technique, as I mentioned above posting.

For your information, a similar issue of keychain in MAC OSX has been reported and already solved using access control technique (please check the related paper “Cracking App Isolation on Apple: Unauthorized Cross-App Resource Access on MAC OS~X and iOS, ACM CCS 2015).

Revision history for this message
Seong-Joong Kim (sungjungk) wrote :

@seb128 Please check this issue.

information type: Private Security → Public Security
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for reporting this bug. The access via DBus when the keyring is unlocked is a well-known issue and the design of the feature as explained when reading the entirety of https://wiki.ubuntu.com/SecurityTeam/FAQ#gnome-keyring. Users who prefer to be prompted can choose to use a separate keyring than the one that is automatically unlocked upon successful login.

That said, I'm not clear if you are saying that the keyring is not locked during screensaver or logout. If either of these is the case, that sounds like a bug. Can you confirm and detail your methodology?

Revision history for this message
Jeremy Bícha (jbicha) wrote :
Changed in gnome-keyring (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.