public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12393] New: ld.so: insecure handling of privileged programs' RPATHs with $ORIGIN
@ 2011-01-12 14:47 thoger at redhat dot com
  2011-04-11 14:22 ` [Bug libc/12393] " thoger at redhat dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: thoger at redhat dot com @ 2011-01-12 14:47 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12393

           Summary: ld.so: insecure handling of privileged programs'
                    RPATHs with $ORIGIN
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: thoger@redhat.com


ld.so currently expands $ORIGIN in privileged programs' RPATH when $ORIGIN is
listed alone (see _dl_dst_count and is_dst):

http://sourceware.org/git/?p=glibc.git;a=blob;f=elf/dl-load.c;h=41b5ce76;hb=master#l220

A local user can make ld.so load malicious DSO if she has write access to some
directory on the same file system as:

$ ln /path/to/suid
$ LD_PRELOAD=payload ./suid


$ORIGIN is not expanded if it's not the only thing in RPATH, e.g. in cases like
$ORIGIN/../lib, as DL_DST_COUNT() returns 0 and expand_dynamic_string_token()
uses strdup rather than _dl_dst_substitute():

http://sourceware.org/git/?p=glibc.git;a=blob;f=elf/dl-load.c;h=41b5ce76;hb=master#l322

If some privileged program is built with such RPATH, malicious DSO can be
loaded regardless of the file system boundaries as:

$ mkdir '$ORIGIN' lib
$ ln -s payload lib/lib-required-by-privileged-program.so
$ /path/to/suid

ld.so searches relative to the CWD.


Few possible fixes were proposed recently, such as:

http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=96611391
http://sourceware.org/ml/libc-hacker/2010-12/msg00001.html

The problem with that approach is that with l_origin == -1,
_dl_dst_substitute() expands "$ORIGIN" to "", which again triggers search
staring from the CWD and can be abused as e.g.:

$ LD_PRELOAD=payload /path/to/suid


First two issues affect multiple glibc versions back, the third one was tested
with Fedora glibc 2.12.2-1 packages.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-27 12:31 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 14:47 [Bug libc/12393] New: ld.so: insecure handling of privileged programs' RPATHs with $ORIGIN thoger at redhat dot com
2011-04-11 14:22 ` [Bug libc/12393] " thoger at redhat dot com
2011-04-16  0:44 ` pasky at suse dot cz
2011-04-17 20:49 ` thoger at redhat dot com
2011-04-18 14:15 ` pasky at suse dot cz
2011-04-18 16:13 ` thoger at redhat dot com
2011-04-22  1:42 ` pasky at suse dot cz
2011-04-26 13:28 ` thoger at redhat dot com
2011-05-03 11:14 ` schwab@linux-m68k.org
2011-05-05 16:53 ` pasky at suse dot cz
2011-05-07 15:46 ` drepper.fsp at gmail dot com
2011-05-09  8:41 ` schwab@linux-m68k.org
2011-05-09 10:25 ` pasky at suse dot cz
2011-05-11  4:17 ` drepper.fsp at gmail dot com
2014-02-16 19:41 ` jackie.rosen at hushmail dot com
2014-05-28 19:44 ` schwab at sourceware dot org
2014-06-27 12:31 ` [Bug libc/12393] ld.so: insecure handling of privileged programs' RPATHs with $ORIGIN (CVE-2011-1658) 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).