Bug 495211 - (staff_u) Zillion nautilus related AVC denials
(staff_u) Zillion nautilus related AVC denials
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Eric Paris
Fedora Extras Quality Assurance
: SELinux
: 518749 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2009-04-10 08:38 EDT by Matěj Cepl
Modified: 2010-06-28 07:47 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-06-28 07:47:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
output of ausearch -m AVC | grep nautilus |grep denied (572.09 KB, text/plain)
2009-04-10 08:41 EDT, Matěj Cepl
no flags Details

  None (edit)
Description Matěj Cepl 2009-04-10 08:38:07 EDT
When running nautilus I get many many AVC denials with various nautilus related actions (see attached log)

Comment 1 Matěj Cepl 2009-04-10 08:41:31 EDT
Created attachment 339086 [details]
output of ausearch -m AVC | grep nautilus |grep denied
Comment 2 Matthias Clasen 2009-04-11 00:21:29 EDT
thats gotta be some mislabeling problem
Comment 3 Daniel Walsh 2009-04-11 07:20:19 EDT

allow staff_t gnome_home_t:file execute;
allow staff_t mozilla_home_t:file execute;

Is allowed now in policy, unless you have 

allow_staff_exec_content turned off.

allow staff_t user_tmp_t:sock_file execute;

Looks like nautilus is doing an execute access check on a sock_file in /tmp, I don't think it makes any sense to execute a sock_file.

I will add dontaudit rules.

nautilus also is checking write access to /tmp/.X11-unix directory?

So I think the problem is nautilus running around checking access to files and directories using access?

Matthias, the reason Matej is seening all these avc's is because he is running with a confined user rather then unconfined_t,  Not related to a mislabeling.
Comment 4 Daniel Walsh 2009-04-11 07:22:26 EDT
If my thoughts are correct on why this is happening, it shows the problem of 

access generating the actual execute or write rather then just a getattr, which I believe is a kernel problem.
Comment 5 Stephen Smalley 2009-04-13 10:02:54 EDT
Not sure I follow, sounds like a topic for selinux list.
Do you want access(2) to only check SELinux getattr permission to the file, like a stat(2) call would?  Rather than checking read/write/execute?

At present, access(2) internally calls the kernel's permission() routine, which invokes both DAC and SELinux MAC checks for read/write/execute.
Comment 6 Daniel Walsh 2009-04-13 14:07:52 EDT
Yes, I would rather have it only generate the getattr access check for MAC.  Since it is not actually executing the code, but reading whether the code can be executed, via DAC.  So in my mind this is a getattr access check.

I understand that it will return the wrong answer on MAC.  Which is a problem.  Currently we have a dontaudit * krb_conf_t:file write; for every domain that uses kerberos, because the kerberos library does a access(/etc/krb5.conf, W_OK) check.  This means we can not tell when an confined domain actually tried to rewrite /etc/krb5.conf.  

So I would like to somehow answer the access(FILE, MODE) question correctly without generating any other then a getattr access violation.
Comment 7 Stephen Smalley 2009-04-13 14:26:19 EDT
It seems unwise to hardcode suppression of the auditing of the read/write/execute check (e.g. via _noaudit interface) if we are in fact going to return that result to the caller of access(2); otherwise, we get silent denials with no way to see them if they do in fact break the application.  So I think dontaudit rules are your best bet there for silencing those, and then the user still has the option to use semodule -DB to uncover them.

If you want to further add a getattr check on access(2), then that just requires adding a call to security_inode_getattr() to sys_faccessat().
Comment 8 Daniel Walsh 2009-04-13 14:49:01 EDT
But they are different.  And we are covering up potential attacks. If every single domain as a dontaudit read of /etc/shadow, because we do an Access check and dontaudit write of /etc/krb5.conf, we can not tell when these files are actually under attack.

How about a different check, getattrmac, which we can give to domains that check.

Or maybe this becomes a new class.

dontaudit abc_t shadow_t:access write;
Comment 9 Stephen Smalley 2009-04-13 15:18:56 EDT
If we use any permission check other than read/write/execute, then we have the potential for inconsistency between access(2) and open(2) with the same requested access, thereby breaking libraries and applications that are using access(2) to decide whether or not to even attempt an open(2) or fall back on an unprivileged code path, ala libkrb and /etc/krb.conf or pam_unix and /etc/shadow.

getattrmac is even worse, as it cannot distinguish read vs. write vs. execute.

Separate class leaves open the possibility of inconsistency and loses ability to distinguish based on the actual file class (e.g. dir vs. file vs. chr_file...).

I don't see a good option.  Might want to take it up on selinux list, cc Eric and James.
Comment 10 Daniel Walsh 2009-04-15 10:56:52 EDT
So now I either have to dontaudit all attemps by users to execute files in their home directory so that Nautilus will not cause hundreds of AVCs or add a policy for Nautilus which would be very difficult since it needs to be able to do everything the user can do.

staff_t + dontaudit HOME/TMP:file execute, +dontaudit HOME/TMP:{ dir file } read;
Comment 11 Daniel Walsh 2009-04-15 10:57:22 EDT
And transition to staff_t when executing any executable that it can execute.
Comment 12 Stephen Smalley 2009-04-15 11:44:09 EDT
I'll take it up on selinux list, as I don't think it is really something we can resolve in a bugzilla.
Comment 13 Alexander Larsson 2009-04-16 13:04:04 EDT
It seems like you're onto this, but yes, to confirm, nautilus uses "access" to determine wheter you're allowed to do things like execute a file. We do this instead of parsing the file mode in order to also correctly work with things like ACLs or selinux denying certain things.

So, from the point of nautilus I'd like selinux to report what would actually happen if we e.g. tried to execute something, but not report a violation if it was not allowed.
Comment 14 Eric Paris 2009-04-16 13:40:23 EDT
1) return from access should report what would actually happen if you tried to execute something.
     - absolutely, there is no reasonable discussion about having access say something is allowed but then it actually be denied.

2) not report a violation if it was not allowed
     - this is a harder thing.  I, for one, see it as a huge problem to usability if selinux is able to deny an operation, but doesn't tell you that it was denied.  I think the upstream discussion is going to give us something that will be able to address everyone's concerns, although it going to take some bit of ugliness in the selinux userspace tools to beat out the specifics.
Comment 15 Alexander Larsson 2009-04-20 06:26:50 EDT
I understand the hesitation to not report this at all. However, at least you need to be able to tell between the actual executing of something and seeing if it is possible.
Comment 16 Bug Zapper 2009-06-09 09:36:44 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
Comment 17 Matěj Cepl 2009-08-17 04:50:08 EDT
Just to note that this is alive and kicking with nautilus-2.26.3-2.fc11.x86_64
and selinux-policy-targeted-3.6.12-77.fc11.noarch.
Comment 18 Daniel Walsh 2009-08-18 08:52:05 EDT
Eric, what is the current state of this.

It seems to have drifted off into the weeds.
Comment 19 Adam Tkac 2009-09-16 11:41:01 EDT
*** Bug 518749 has been marked as a duplicate of this bug. ***
Comment 20 Bug Zapper 2010-04-27 09:37:00 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

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 prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 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 please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

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.

The process we are following is described here: 
Comment 21 Bug Zapper 2010-06-28 07:47:24 EDT
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 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.

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

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