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 2215507 - Listing /var with details (ls -l /var) leads to missing permissions printing on some directories
Summary: Listing /var with details (ls -l /var) leads to missing permissions printing ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.0
Hardware: All
OS: All
low
low
Target Milestone: rc
: ---
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 2216151
TreeView+ depends on / blocked
 
Reported: 2023-06-16 09:24 UTC by Welterlen Benoit
Modified: 2023-11-07 11:23 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-38.1.20-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2216151 (view as bug list)
Environment:
Last Closed: 2023-11-07 08:52:30 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-160053 0 None None None 2023-06-16 09:26:51 UTC
Red Hat Product Errata RHBA-2023:6617 0 None None None 2023-11-07 08:52:45 UTC

Description Welterlen Benoit 2023-06-16 09:24:59 UTC
Description of problem:

With MLS policy and running in staff_r role, listing /var with details (ls -l /var) leads to missing permissions printing on some directories /var/account, /var/crash and /var/yp:

---
# id -Z
root:staff_r:staff_t:s0-s15:c0.c1023

# ls -l /var
ls: cannot access '/var/yp': Permission denied
ls: cannot access '/var/crash': Permission denied
ls: cannot access '/var/account': Permission denied
total 16
d??????????  ? ?    ?       ?            ? account
drwxr-xr-x.  2 root root    6 Aug 10  2021 adm
drwxr-xr-x. 18 root root 4096 Jan 27 10:15 cache
d??????????  ? ?    ?       ?            ? crash
drwxr-xr-x.  3 root root   18 Jan 27 10:01 db
drwxr-xr-x.  2 root root    6 Aug 10  2021 empty
drwxr-xr-x.  2 root root    6 Aug 10  2021 ftp
drwxr-xr-x.  2 root root    6 Aug 10  2021 games
drwxr-xr-x.  3 root root   18 Jan 27 10:01 kerberos
drwxr-xr-x. 59 root root 4096 Feb  6 10:06 lib
drwxr-xr-x.  2 root root    6 Aug 10  2021 local
lrwxrwxrwx.  1 root root   11 Jan 27 10:00 lock -> ../run/lock
drwxr-xr-x. 15 root root 4096 Feb  5 21:32 log
lrwxrwxrwx.  1 root root   10 Aug 10  2021 mail -> spool/mail
drwxr-xr-x.  2 root root    6 Aug 10  2021 nis
drwxr-xr-x.  2 root root    6 Aug 10  2021 opt
drwxr-xr-x.  2 root root    6 Aug 10  2021 preserve
lrwxrwxrwx.  1 root root    6 Jan 27 10:00 run -> ../run
drwxr-xr-x. 10 root root  106 Jan 27 10:03 spool
drwxrwxrwt.  7 root root 4096 Jun 16 11:02 tmp
d??????????  ? ?    ?       ?            ? yp
---

- if we disable the dontaudit rules, we can see the AVC:

---
type=AVC msg=audit(1686904726.400:201): avc:  denied  { getattr } for  pid=1502 comm="ls" path="/var/yp" dev="dm-0" ino=33839460 scontext=root:staff_r:staff_t:s0-s15:c0.c1023 tcontext=system_u:object_r:var_yp_t:s0 tclass=dir permissive=1
type=SYSCALL msg=audit(1686904726.400:201): arch=c000003e syscall=332 success=yes exit=0 a0=ffffff9c a1=7fff8c839a20 a2=100 a3=25e items=0 ppid=1464 pid=1502 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=3 comm="ls" exe="/usr/bin/ls" subj=root:staff_r:staff_t:s0-s15:c0.c1023 key=(null)ARCH=x86_64 SYSCALL=statx AUID="root" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root"
type=PROCTITLE msg=audit(1686904726.400:201): proctitle=6C73002D2D636F6C6F723D6175746F002D6C002F766172
type=AVC msg=audit(1686904726.400:202): avc:  denied  { getattr } for  pid=1502 comm="ls" path="/var/crash" dev="dm-0" ino=35114033 scontext=root:staff_r:staff_t:s0-s15:c0.c1023 tcontext=system_u:object_r:kdump_crash_t:s0 tclass=dir permissive=1
type=SYSCALL msg=audit(1686904726.400:202): arch=c000003e syscall=332 success=yes exit=0 a0=ffffff9c a1=7fff8c839a10 a2=100 a3=25e items=0 ppid=1464 pid=1502 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=3 comm="ls" exe="/usr/bin/ls" subj=root:staff_r:staff_t:s0-s15:c0.c1023 key=(null)ARCH=x86_64 SYSCALL=statx AUID="root" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root"
type=PROCTITLE msg=audit(1686904726.400:202): proctitle=6C73002D2D636F6C6F723D6175746F002D6C002F766172
type=AVC msg=audit(1686904726.400:203): avc:  denied  { getattr } for  pid=1502 comm="ls" path="/var/account" dev="dm-0" ino=51226390 scontext=root:staff_r:staff_t:s0-s15:c0.c1023 tcontext=system_u:object_r:acct_data_t:s0 tclass=dir permissive=1
type=SYSCALL msg=audit(1686904726.400:203): arch=c000003e syscall=332 success=yes exit=0 a0=ffffff9c a1=7fff8c839a10 a2=100 a3=25e items=0 ppid=1464 pid=1502 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=3 comm="ls" exe="/usr/bin/ls" subj=root:staff_r:staff_t:s0-s15:c0.c1023 key=(null)ARCH=x86_64 SYSCALL=statx AUID="root" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root"
type=PROCTITLE msg=audit(1686904726.400:203): proctitle=6C73002D2D636F6C6F723D6175746F002D6C002F766172
---

- From the policy, staff_t is not allowed to getattr for these dir:

---
$ sesearch -A -s staff_t -p getattr -c dir -t acct_data_t
<...>

$ sesearch -A -s staff_t -p getattr -c dir -t httpd_sys_content_t
<...>

$ sesearch -A -s staff_t -p getattr -c dir -t kdump_crash_t
<...>

$ sesearch -A -s staff_t -p getattr -c dir -t var_yp_t
allow nsswitch_domain var_yp_t:dir { getattr ioctl lock open read search }; [ nis_enabled ]:True
---

- Is there a reason to have this deny for staff_r ?

Version-Release number of selected component (if applicable):
selinux-policy-mls-34.1.29-1.el9_0.2.noarch
RHEL9

How reproducible:
always

Steps to Reproduce:
1. enable MLS
2. ls -l /var
3.

Actual results:
Directory attributes are not printed.


Expected results:
Details on directories

Additional info:

Comment 1 Zdenek Pytela 2023-08-04 20:54:27 UTC
Commit to backport:
af31eedaf Allow user_u and staff_u get attributes of non-security dirs

Comment 10 errata-xmlrpc 2023-11-07 08:52:30 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-2023:6617


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