Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1336902 - chpasswd allows for SELinux sandbox breakout in certain situations
chpasswd allows for SELinux sandbox breakout in certain situations
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: shadow-utils (Show other bugs)
7.2
All Linux
unspecified Severity low
: rc
: ---
Assigned To: Tomas Mraz
Stefan Kremen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-05-17 14:24 EDT by exm6939
Modified: 2016-11-03 23:41 EDT (History)
8 users (show)

See Also:
Fixed In Version: shadow-utils-4.1.5.1-21.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 23:41:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
CentOS 10867 None None None 2016-05-17 14:24 EDT
Red Hat Product Errata RHBA-2016:2322 normal SHIPPED_LIVE shadow-utils bug fix and enhancement update 2016-11-03 09:43:15 EDT

  None (edit)
Description exm6939 2016-05-17 14:24:59 EDT
Description of problem:
chpasswd is not SELinux aware, but is granted a default policy as if it was. Therefore root accounts with SELinux restrictions can bypass these restrictions.

Version-Release number of selected component (if applicable):
redhat-release-server-7.2-9.el7.x86_64

How reproducible:
Always.


Steps to Reproduce:
1. Create administrative account e.g. superadmin, add to wheel group
2. Add superadmin to staff_u or root selinux group: semanage -a -s root -r s0-s0:c0.c1023 superadmin
3. Restrict root account to user_u user context: semanage -m -s user_u -r s0 root
4. As "user_u" root account, change superadmin's password: echo "superadmin:owned" | chpasswd

Actual results:
Password of superadmin is changed to owned. This is unexpected since user_u should not be able to change the password of someone with a user context of root.

Expected results:
Access denied since it is the user_u context.

Additional info:
7.1 does not have this issue since the chpasswd binary is labeled as bin_t. That is only a temporary fix, the actual fix being making chpasswd SELinux aware/supported (upstream issue: https://github.com/shadow-maint/shadow/issues/22).
Comment 2 Tomas Mraz 2016-05-26 05:07:18 EDT
This change should be reverted in selinux-policy for now. Adding selinux support to chpasswd would have to be done upstream first.
Comment 4 Milos Malik 2016-05-26 06:12:23 EDT
RHEL-7.1
========
# matchpathcon `which chpasswd `
/usr/sbin/chpasswd	system_u:object_r:bin_t:s0
#

RHEL-7.2
========
# matchpathcon `which chpasswd `
/usr/sbin/chpasswd	system_u:object_r:passwd_exec_t:s0
#
Comment 5 Lukas Vrabec 2016-05-26 08:30:37 EDT
Hi Tomas, 

This change is related to this bz:
https://bugzilla.redhat.com/show_bug.cgi?id=1243458

We should find other way how to fix it.
Comment 11 errata-xmlrpc 2016-11-03 23:41:42 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2322.html

Note You need to log in before you can comment on or make changes to this bug.