public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/18683] New: Linux faccessat implementation can incorrectly ignore AT_EACCESS
@ 2015-07-15 21:11 jld at mozilla dot com
  2015-07-24 11:26 ` [Bug libc/18683] " fweimer at redhat dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jld at mozilla dot com @ 2015-07-15 21:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18683

            Bug ID: 18683
           Summary: Linux faccessat implementation can incorrectly ignore
                    AT_EACCESS
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: jld at mozilla dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

The Linux implementation of faccessat() assumes that if __libc_enable_secure is
0 then the process's real and effective capabilities are equal and it can
ignore AT_EACCESS in order to use the faccessat syscall (instead of, as
documented, imperfectly emulating it with fstatat).

But this isn't quite correct: if the process has CAP_SETUID and/or CAP_SETGID
(e.g., if it's run as root) it can start with equal real/effective capabilities
and change them later.

For example, in a program run as uid 0, assuming "/etc/passwd" is a regular
file with mode 0644 owned by uid 0:

seteuid(-2) => 0
faccessat(AT_FDCWD, "/etc/passwd", W_OK, AT_EACCESS) => 0
open("/etc/passwd", O_WRONLY) => -1

I'm not sure how important this bug is (the usual warnings about
time-of-check/time-of-use issues apply to most use cases for faccessat, and
it's currently impossible to implement faccessat correctly on Linux), but I
thought it should at least be on file for if/when someone else runs into it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-07 20:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-15 21:11 [Bug libc/18683] New: Linux faccessat implementation can incorrectly ignore AT_EACCESS jld at mozilla dot com
2015-07-24 11:26 ` [Bug libc/18683] " fweimer at redhat dot com
2015-10-13 12:17 ` fweimer at redhat dot com
2015-10-13 12:20 ` fweimer at redhat dot com
2020-04-16 12:51 ` fweimer at redhat dot com
2020-04-16 12:56 ` carlos at redhat dot com
2020-08-07 16:21 ` fweimer at redhat dot com
2020-08-07 20:08 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).