Bug 1001871

Summary: SELinux allows user_u to obtain quasi root prompt
Product: [Fedora] Fedora Reporter: JR <bucketofsnow>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED EOL QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: unspecified    
Version: 19CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 16:57:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description JR 2013-08-28 02:44:47 UTC
Description of problem:
A user confined as user_u (id -Z yields user_u:user_r:user_t:s0) can now get a quasi-root prompt as shown below.  This is on Fedora 19 x86_64 XFCE Spin install with a 'fixfiles onboot' completed and rebooted.

$ su -
Password:
-bash: /root/.bash_profile: Permission denied
-bash-4.2# dmesg
dmesg: read kernel buffer failed: Permission denied
-bash-4.2# logout
-bash: /root/.bash_logout: Permission denied

....

$ su -
Password:
-bash: /root/.bash_profile: Permission denied
-bash-4.2# whoami
root
-bash-4.2# logout
-bash: /root/.bash_logout: Permission denied

Version-Release number of selected component (if applicable):
$ rpm -qa | grep selinux
selinux-policy-3.12.1-73.fc19.noarch
libselinux-2.1.13-15.fc19.x86_64
libselinux-utils-2.1.13-15.fc19.x86_64
selinux-policy-targeted-3.12.1-73.fc19.noarch
selinux-policy-devel-3.12.1-73.fc19.noarch
libselinux-python-2.1.13-15.fc19.x86_64


How reproducible:
Always with packages listed above.

Steps to Reproduce:
1. Create a user and confine them to user_u
2. Log out and log back in as user
3. Open a terminal and execute su -

Actual results:
After accepting the password, a quasi-root prompt is available.

Expected results:
The su command should return an error and not even prompt for password. (This is how it worked until the most recent SELinux update.)

Additional info:
A few of the denied AVC messages:

type=AVC msg=audit(1377657010.371:726): avc:  denied  { read } for  pid=2560 comm="bash" name=".bash_profile" dev="sda7" ino=523269 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:admin_home_t:s0 tclass=file

type=AVC msg=audit(1377657010.371:727): avc:  denied  { read } for  pid=2560 comm="bash" name=".bash_history" dev="sda7" ino=523294 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:admin_home_t:s0 tclass=file

# rpm -qa | grep kernel
kernel-modules-extra-3.10.9-200.fc19.x86_64
texlive-l3kernel-svn29409.SVN_4469-0.1.fc19.noarch
kernel-3.10.6-200.fc19.x86_64
libreport-plugin-kerneloops-2.1.6-2.fc19.x86_64
kernel-3.10.7-200.fc19.x86_64
kernel-modules-extra-3.10.6-200.fc19.x86_64
kernel-3.10.9-200.fc19.x86_64
abrt-addon-kerneloops-2.1.6-3.fc19.x86_64
kernel-devel-3.10.6-200.fc19.x86_64
kernel-modules-extra-3.10.7-200.fc19.x86_64
kernel-devel-3.10.7-200.fc19.x86_64
kernel-headers-3.10.9-200.fc19.x86_64
kernel-devel-3.10.9-200.fc19.x86_64

SELinux is in enforcing mode:
# getenforce
Enforcing

Comment 1 Daniel Walsh 2013-08-28 19:11:44 UTC
Do you have the selinuxuser_use_ssh_chroot boolean turned on?

Comment 2 JR 2013-08-28 23:24:35 UTC
Yes, it is still at the default for a Fedora 19 installation:

selinuxuser_use_ssh_chroot     (on   ,   on)  Allow user  to use ssh chroot environment.

Thanks in advance!

Comment 3 Miroslav Grepl 2013-08-29 09:41:44 UTC
Should be turned off by default.

# getsebool selinuxuser_use_ssh_chroot
selinuxuser_use_ssh_chroot --> off

Comment 4 Daniel Walsh 2013-08-29 12:57:32 UTC
Was this ever defaulted to on?

Comment 5 Miroslav Grepl 2013-08-29 13:18:32 UTC
It was not, AFAIK.

Comment 6 Fedora End Of Life 2015-01-09 19:37:12 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-02-17 16:57:01 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.