Skip to contentSkip to conversation

Incorrect check in pam_rootok

PATCH Christopher J. PeBenito 2 participants 2 messages Aug 12, 2015 SELinux security module

lore
Share & tools
lore
#0 lore raw

Working an issue here, we uncovered that PAM is checking the wrong SELinux permission in the pam_rootok module; it checks the passwd permission instead of the rootok permission. This issue was reported earlier this year[1] but no action has been taken.

This has been around since early 2013, when the code was changed from the old checkPasswdAccess() to selinux_check_access(), but an impact to users would be rare since most domains that have the rootok permission also have the passwd permission.

[1] https://fedorahosted.org/linux-pam/ticket/37

(quoted diff) +0 -0

b/modules/pam_rootok/pam_rootok.c
index 70579e5..88bed0c 100644

modules/pam_rootok/pam_rootok.c +0 -1
@@ -106,7 +106,7 @@ selinux_check_root (void)
        return status;
     }
 
-    status = selinux_check_access(user_context, user_context, "passwd",

"passwd", NULL);
+ status = selinux_check_access(user_context, user_context, "passwd",
"rootok", NULL);

     selinux_set_callback(SELINUX_CB_LOG, old_callback);
     freecon(user_context);
Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#1 lore raw
Quoted 26 lines · Christopher J. PeBenito

Working an issue here, we uncovered that PAM is checking the wrong SELinux permission in the pam_rootok module; it checks the passwd permission instead of the rootok permission. This issue was reported earlier this year[1] but no action has been taken.

This has been around since early 2013, when the code was changed from the old checkPasswdAccess() to selinux_check_access(), but an impact to users would be rare since most domains that have the rootok permission also have the passwd permission.

[1] https://fedorahosted.org/linux-pam/ticket/37

modules/pam_rootok/pam_rootok.c +1 -1
index 70579e5..88bed0c 100644
@@ -106,7 +106,7 @@ selinux_check_root (void)
        return status;
     }
 
-    status = selinux_check_access(user_context, user_context, "passwd",
 "passwd", NULL);
+    status = selinux_check_access(user_context, user_context, "passwd",
 "rootok", NULL);
 
Quoted 3 lines
     selinux_set_callback(SELINUX_CB_LOG, old_callback);
     freecon(user_context);

Thank you for the heads-up. I committed the fix into the upstream git master branch.

Signature · 4 lines
Tomas Mraz
No matter how far down the wrong road you've gone, turn back.
                                              Turkish proverb
(You'll never know whether the road is wrong though.)