First published: Fri Aug 20 2010(Updated: )
Harald van Dijk discovered [1],[2] that glibc's locale command does not sufficiently sanitize the user environment. According to POSIX specifications [3], the output of the 'locale' command must be appropriately quoted and safe to execute, in order to restore the locale after temporarily forcing a change (such as LC_ALL=C). However, this is not the case with glibc versions up to and including 2.12.1: LANG=' rm -rf /' locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG= rm -rf / LC_CTYPE=" rm -rf /" LC_NUMERIC=" rm -rf /" LC_TIME=" rm -rf /" LC_COLLATE=" rm -rf /" LC_MONETARY=" rm -rf /" LC_MESSAGES=" rm -rf /" LC_PAPER=" rm -rf /" LC_NAME=" rm -rf /" LC_ADDRESS=" rm -rf /" LC_TELEPHONE=" rm -rf /" LC_MEASUREMENT=" rm -rf /" LC_IDENTIFICATION=" rm -rf /" LC_ALL= Any script that does "eval $(locale)" or something similar will execute the unquoted commands. The POSIX specification states: "The <value> and <implied value> shown above shall be properly quoted for possible later reentry to the shell. The <value> shall not be quoted using double-quotes (so that it can be distinguished by the user from the <implied value> case, which always requires double-quotes)." This has been corrected upstream [4]. [1] <a href="http://bugs.gentoo.org/show_bug.cgi?id=330923">http://bugs.gentoo.org/show_bug.cgi?id=330923</a> [2] <a href="http://sources.redhat.com/bugzilla/show_bug.cgi?id=11904">http://sources.redhat.com/bugzilla/show_bug.cgi?id=11904</a> [3] <a href="http://www.opengroup.org/onlinepubs/000095399/utilities/locale.html">http://www.opengroup.org/onlinepubs/000095399/utilities/locale.html</a> [4] <a href="http://sourceware.org/git/?p=glibc.git;a=patch;h=026373745eab50a683536d950cb7e17dc98c4259">http://sourceware.org/git/?p=glibc.git;a=patch;h=026373745eab50a683536d950cb7e17dc98c4259</a>
Credit: secalert@redhat.com
Affected Software | Affected Version | How to fix |
---|---|---|
GNU glibc | =2.2.2 | |
GNU glibc | =2.9 | |
GNU glibc | =2.7 | |
GNU glibc | =2.1.2 | |
GNU glibc | =2.11 | |
GNU glibc | =2.0.5 | |
GNU glibc | =2.2.5 | |
GNU glibc | =2.0.6 | |
GNU glibc | =2.10.1 | |
GNU glibc | =1.00 | |
GNU glibc | =1.06 | |
GNU glibc | =2.1.1 | |
GNU glibc | =1.02 | |
GNU glibc | =2.0.3 | |
GNU glibc | =1.07 | |
GNU glibc | =2.3.1 | |
GNU glibc | =2.3 | |
GNU glibc | =2.12.0 | |
GNU glibc | =2.0 | |
GNU glibc | =2.1.1.6 | |
GNU glibc | =1.04 | |
GNU glibc | =1.01 | |
GNU glibc | =2.3.10 | |
GNU glibc | =2.4 | |
GNU glibc | =2.1 | |
GNU glibc | =2.3.4 | |
GNU glibc | =1.09.1 | |
GNU glibc | =2.1.9 | |
GNU glibc | =2.3.3 | |
GNU glibc | =2.12.1 | |
GNU glibc | =2.6.1 | |
GNU glibc | =2.0.1 | |
GNU glibc | =1.09 | |
GNU glibc | =2.10 | |
GNU glibc | =2.11.2 | |
GNU glibc | =2.5.1 | |
GNU glibc | =2.6 | |
GNU glibc | =2.0.4 | |
GNU glibc | =2.0.2 | |
GNU glibc | =2.2.1 | |
GNU glibc | =2.3.2 | |
GNU glibc | =1.03 | |
GNU glibc | =2.1.3.10 | |
GNU glibc | =2.3.6 | |
GNU glibc | <=2.12.2 | |
GNU glibc | =2.2.3 | |
GNU glibc | =2.5 | |
GNU glibc | =2.11.3 | |
GNU glibc | =1.08 | |
GNU glibc | =2.3.5 | |
GNU glibc | =2.8 | |
GNU glibc | =2.11.1 | |
GNU glibc | =2.2.4 | |
GNU glibc | =2.1.3 | |
GNU glibc | =1.05 | |
GNU glibc | =2.2 | |
GNU glibc | =2.10.2 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.