Credentials located in gnome-keyring can be compromised easily.
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 . 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>