public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17100] New: secure_getenv() does not seem to properly detect if an environment is secure
@ 2014-06-29  3:17 busterb at gmail dot com
  2014-06-29  7:40 ` [Bug libc/17100] " schwab@linux-m68k.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: busterb at gmail dot com @ 2014-06-29  3:17 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 17100
           Summary: secure_getenv() does not seem to properly detect if an
                    environment is secure
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: busterb at gmail dot com
                CC: drepper.fsp at gmail dot com

Until getauxval(AT_SECURE) was added, there did not appear to be a good way to
detect if a process is running setuid/setgid or not. You can find various
discussions about how to implement the BSD issetugid() function on Linux for
reference.

Checks like (uid==euid||gid==egid) can fail in various ways, e.g. it cannot
detect if a process has changed its uid/gid back, it is racy in multi-threaded
contexts, among other issues. I think that future glibc versions should only
use AT_SECURE, removing the getuid/geteuid check. If AT_SECURE is unavailable,
just assume the worst.

<snip>
     case AT_SECURE:
   seen = -1;
   __libc_enable_secure = av->a_un.a_val;
   __libc_enable_secure_decided = 1;

<snip>
__libc_init_secure (void)
{
 if (__libc_enable_secure_decided == 0)
   __libc_enable_secure = (__geteuid () != __getuid ()
               || __getegid () != __getgid ());
}

<snip>
char *
__libc_secure_getenv (name)
    const char *name;
{
 return __libc_enable_secure ? NULL : getenv (name);
}

-- 
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:[~2014-06-29 15:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-29  3:17 [Bug libc/17100] New: secure_getenv() does not seem to properly detect if an environment is secure busterb at gmail dot com
2014-06-29  7:40 ` [Bug libc/17100] " schwab@linux-m68k.org
2014-06-29 11:55 ` joseph at codesourcery dot com
2014-06-29 12:17 ` fweimer at redhat dot com
2014-06-29 13:36 ` busterb at gmail dot com
2014-06-29 13:52 ` fweimer at redhat dot com
2014-06-29 14:04 ` busterb at gmail dot com
2014-06-29 15:20 ` joseph at codesourcery 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).