Commit 9db67ef6 authored by Nicolas Iooss's avatar Nicolas Iooss Committed by Stef Walter
Browse files

pam: Destroy the password in pam_sm_open_session

gnome-keyring PAM module saves the password of the user in a blob
associated with a PAM handle, using pam_set_data (ph,
"gkr_system_authtok"...) in stash_password_for_session. This data is
kept in the process memory once the PAM session is opened, which allows
root user to read it, for example using gcore.

This password leakage has recently been instrumented with tools such as
mimipenguin ( and

Fix this leak by destroying the data blob which hold the password once
it has been used in pam_sm_open_session.
parent 7bc86dd4
......@@ -894,6 +894,12 @@ pam_sm_open_session (pam_handle_t *ph, int flags, int argc, const char **argv)
ret = start_daemon (ph, pwd, true, password);
/* Destroy the stored authtok once it has been used */
if (password && pam_set_data (ph, "gkr_system_authtok", NULL, NULL) != PAM_SUCCESS) {
syslog (GKR_LOG_ERR, "gkr-pam: error destroying the password");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment