Bug 11904 (CVE-2011-1095) - locale command does not quote (invalid) locale strings (CVE-2011-1095)
Summary: locale command does not quote (invalid) locale strings (CVE-2011-1095)
Status: RESOLVED FIXED
Alias: CVE-2011-1095
Product: glibc
Classification: Unclassified
Component: localedata (show other bugs)
Version: 2.11
: P2 normal
Target Milestone: ---
Assignee: GNU C Library Locale Maintainers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 20:07 UTC by Harald van Dijk
Modified: 2015-02-24 15:55 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald van Dijk 2010-08-11 20:07:07 UTC
eval "`locale`" is supposed to be safe. From
<http://www.opengroup.org/onlinepubs/000095399/utilities/locale.html>: "The
<value> and <implied value> shown above shall be properly quoted for possible
later reentry to the shell." glibc's locale command does not do this, and as a
result, if a script does eval "`locale`", it misbehaves badly when someone
figures out to set LANG to ' rm -rf /'.

$ 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=
$ echo $?
0
Comment 1 Ulrich Drepper 2010-08-12 16:06:13 UTC
Fixed in git.