Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 86844

Summary: stable glibc completely filters LD_PRELOAD for setuid/setgid binaries
Product: Gentoo Linux Reporter: Richard Fish <bigfish>
Component: [OLD] LibraryAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED WORKSFORME    
Severity: normal CC: stian
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Richard Fish 2005-03-27 03:28:25 UTC
In addition to fixing an LD_DEBUG vulnerability (GLSA 200408-16), glibc-sec-hotfix-20040916.patch moves the cleansing of the LD_ environment to before the environment is saved for the current process.  This disables LD_PRELOAD for all setuid/setgid binaries.  This part of the patch did not make it into the glibc CVS repository, and does not appear in glibc-20050125-r1.

Reproducible: Always
Steps to Reproduce:
> sudo chmod 4444 /lib/libz.so
> sudo chmod 4755 /usr/bin/strace
> /usr/bin/strace -e open -E LD_PRELOAD=libz.so /bin/login 2>&1 | grep libz


Actual Results:  
With glibc versions before 2.3.4.20050125, libz.so will not be loaded by /bin/login.
Comment 1 Richard Fish 2005-03-27 03:44:18 UTC
*** Bug 86848 has been marked as a duplicate of this bug. ***
Comment 2 Stian Skjelstad 2005-07-17 05:27:08 UTC
isn't LD_PRELOAD seen as a security problem for setuid/setgid programs in general?
Comment 3 Richard Fish 2005-07-17 14:15:45 UTC
Yes, which is why the glibc provided by gnu:

1. requires any LD_PRELOAD libraries for a setuid/setgid executable also be
marked setuid/setgid, the assumption being that the administrator knows whether
a particular library is safe or not.

2. filters LD_PRELOAD from the environment after performing the resolution, so
that no child processes spawned by the setuid/setgid program inherit this
setting.  The program must reset LD_PRELOAD if necessary...as you can see from
my strace example.
Comment 4 SpanKY gentoo-dev 2005-07-17 22:41:35 UTC
we're pushing glibc-2.3.5 which should be OK

if you want, post an updated glibc-sec-hotfix-20040916.patch and i'll merge it,
otherwise i'll just leave this as resolved