RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1907517 - Linux user mapped into SELinux user_u can use sudo/su to evaluate permissions to root
Summary: Linux user mapped into SELinux user_u can use sudo/su to evaluate permissions...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.3
Hardware: Unspecified
OS: Linux
high
medium
Target Milestone: rc
: 8.4
Assignee: Zdenek Pytela
QA Contact: Milos Malik
Jan Fiala
URL:
Whiteboard:
Depends On:
Blocks: 1778780 1962297
TreeView+ depends on / blocked
 
Reported: 2020-12-14 16:43 UTC by Chandan Chouhan
Modified: 2024-06-13 23:42 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.14.3-66.el8
Doc Type: Bug Fix
Doc Text:
.`user_u` SELinux users can no longer use `sudo` or `su` The SELinux policy incorrectly allowed users with the `user_r` role to use the `su` and `sudo` commands, and users with the `staff_r` role to use `su`. The policy has been updated, and users with the `user_r` role now cannot use `su` or `sudo`, and users with the `staff_r` role now cannot use `su`, but can use `sudo`. IMPORTANT: If the the `selinuxuser_use_ssh_chroot` boolean is set to `on`, all confined users (`guest_u`, `xguest_u`, `user_u`, `staff_u`, and `sysadm_u`) can still use `sudo`.
Clone Of:
: 1962297 (view as bug list)
Environment:
Last Closed: 2021-05-18 14:58:20 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy issues 325 0 None open user_u can execute setuid binaries 2021-02-15 09:07:29 UTC

Description Chandan Chouhan 2020-12-14 16:43:29 UTC
Description of problem:
According to the RHEL SELinux documentation, Linux user mapped into SELinux 'user_u' shouldn't be able to use "su" or "sudo". 

Version-Release number of selected component (if applicable):
rhel-8.3

[root@localhost ~]# rpm -qa | grep -i selinux-policy
selinux-policy-targeted-3.14.3-54.el8.noarch
selinux-policy-3.14.3-54.el8.noarch


How reproducible:

1. Add a user test.
2. echo "password" | passwd --stdin test.
3. # cat /etc/sudoers | grep -i test
test	ALL=(ALL) 	ALL
4. Then login using test user via ssh. test user is able to because root as below:

[test@localhost ~]$ whoami 
test

[test@localhost ~]$ id -Z
user_u:user_r:user_t:s0

[test@localhost ~]$ sudo -i 
sudo: unable to open /run/sudo/ts/test: Permission denied

[sudo] password for test: 
sudo: unable to stat /var/db/sudo: Permission denied
-bash: /root/.bash_profile: Permission denied

[root@localhost ~]# whoami 
root

[root@localhost ~]# id -Z
user_u:user_r:user_t:s0
~~~~

Actual results:
test user became root 


Expected results:
test user shouldn't get root permissions


Additional info:
This has been tested on rhel-8.0 as well and it works properly ( blocking access ):

# rpm -qa | grep -i selinux
selinux-policy-3.14.1-61.el8.noarch
selinux-policy-targeted-3.14.1-61.el8.noarch

$ sudo -i
sudo: PERM_SUDOERS: setresuid(-1, 1, -1): Operation not permitted
sudo: no valid sudoers sources found, quitting
sudo: setresuid() [0, 0, 0] -> [1001, -1, -1]: Operation not permitted
sudo: unable to initialize policy plugin

Comment 32 errata-xmlrpc 2021-05-18 14:58:20 UTC
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 (selinux-policy bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2021:1639


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