Re: [Full-disclosure] DLL hijacking on Linux



On Wednesday 25 August 2010 02:26:22 Tim Brown wrote:
All,

If you've seen the recent Microsoft advisory. I put together a nice post
on a similar DLL hijacking issue that affects Linux (and other
POSIX-alikes). You can read the full details on my blog (http://www.nth-
dimension.org.uk/blog.php?id=87) but the key point is that an empty
directory specification statement in LD_LIBRARY_PATH, PATH (and probably
others) is equivalent to $CWD. That is to say that
LD_LIBRARY_PATH=":/lib" is equivalent to LD_LIBRARY_PATH=".:/lib". It can
occur when a script has
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/lib" or similar and LD_LIBRARY_PATH
hasn't previously been defined. It's worth checking for this kind of
thing in scripts that may be run via sudo/su when auditing hosts. I don't
believe it's a vulnerability per se, but particular instances of broken
scripts may well be.

man sudo(8):
"Note that the dynamic linker on most operating systems will remove variables
that can control dynamic linking from the environment of setuid executables,
including sudo. Depending on the operating system this may include _RLD*,
DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others. These type of variables
are removed from the environment before sudo even begins execution and, as
such, it is not possible for sudo to preserve them."

--
Mihai Donțu

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/

Relevant Pages

  • Re: organizing your scripts, with plenty of re-use
    ... boilerplate that installation to the PYTHONPATH was supposed to avoid. ... PYTHONPATH an environment variable that the user can set. ... developers without much options beyond "all scripts in one directory" ...
    (comp.lang.python)
  • Re: unexpected script output
    ... Give sudo a try. ... I pretty much only ever suspend to ... reasonable to do it using a combination of the /etc/acpi scripts to ... Is there is a real difference between runlevels and ...
    (Debian-User)
  • Sudo version 1.6.4 now available (fwd)
    ... Sudo version 1.6.4 is now available. ... o Visudo now checks for the existence of an editor and gives a sensible ... o Environment munging is now done by hand. ... to modify the builtin list of environment variables to remove. ...
    (Bugtraq)
  • Re: Packages - whats the best way?
    ... It isn't about restricting privilege. ... It is about the invocation environment. ... With sudo you manage your own password. ... Sharing the root password is ...
    (Debian-User)
  • Re: Having Tcl script accessing files as a specific user
    ... This is a classic problem for sudo to solve. ... delegate restricted root-level rights to non-root users. ... This is not an issue of having scripts run on another folder, ...
    (comp.lang.tcl)