Bug 129682 - $LD_LIBRARY_PATH omitted from environment of setuid/setgid programs run by non-owner user
$LD_LIBRARY_PATH omitted from environment of setuid/setgid programs run by no...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks: 118262
  Show dependency treegraph
 
Reported: 2004-08-11 15:56 EDT by Jason Vas Dias
Modified: 2016-11-24 11:02 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-11 17:30:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jason Vas Dias 2004-08-11 15:56:51 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
 A program with either or both of the setuid / setgid mode bits 
 set cannot obtain $LD_LIBRARY_PATH from environment of invoking
 user if that user is not the program file owner.

 IE. if a user has set the LD_LIBRARY_PATH environment variable,
 and invokes a setuid/setgid program, that program gets the 
 user's environment with LD_LIBRARY_PATH omitted, unless the
 user is the owner of the program file. 
 
 This could be a security "feature" ; if so, it is not documented
 anywhere (man execve, man 5 environ, man setuid...) - it should be!
 
 This happens on FC2, FC3, and RHEL-3.0-U3.

 This breaks programs like at(1) which record the environment of the
 invoking user (bug 118262 was raised by user about this issue). 
  
 I think this is a bug, because it happens for programs with the
 setuid/setgid bit set WHICH HAVE NOT CALLED setuid() or setgid() -
 ie. they are still running with real uid/gid of the user which
 invokes them and effective uid/gid of file owner.

 

 


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.
$ ls -l /bin/env
-rwxr-xr-x  1 root root 15200 May  4 12:26 /bin/env
$ export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
$ /bin/env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
(now as root do chmod +s /bin/env)
$ ls -l /bin/env
-rwsr-sr-x  1 root root 15200 May  4 12:26 /bin/env
$ /bin/env | grep LD_LIBRARY_PATH
( LD_LIBRARY_PATH not in environment! )
2.
3.
    

Actual Results:  LD_LIBRARY_PATH is omitted from environment if
effective uid/gid != real uid/gid

Expected Results:  LD_LIBRARY_PATH should be in environment of
executed program if it was
in environment of executing program

Additional info:
Comment 1 Jakub Jelinek 2004-08-11 17:30:23 EDT
This is of course a security measure, there are many env variables
removed from the environment and disregarded for setuid or setgid
apps, including LD_PRELOAD, LD_LIBRARY_PATH, LD_ORIGIN_PATH, LD_DEBUG_OUTPUT, LD_PROFILE, LD_USE_LOAD_BIAS, GCONV_PATH, HOSTALIASES, LOCALDOMAIN, LOCPATH, MALLOC_TRACE, NLSPATH, RESOLV_HOST_CONF, RES_OPTIONS, TMPDIR and TZDIR.
All Unices I know of behave this way.

If you don't see this documented, it is a man-pages bug, not glibc
bug.
Comment 2 Mikel Ward 2011-04-13 22:39:10 EDT
For what it's worth, it's documented in ld.so(8).

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