[PATCH v7] intl: Restrict path traversal when using LANGUAGE env var [BZ #17142, CVE-2026-84243]
Florian Weimer
fweimer@redhat.com
Thu Nov 12 11:31:09 GMT 2026
* Aurelien Jarno:
> Hi,
>
> On 2026-10-12 16:54, Avinal Kumar wrote:
>> The fix for CVE-2014-0475 (Bug 17137) added valid_locale_name() in
>> locale/findlocale.c to reject locale names containing ".." path
>> components. However, the LANGUAGE environment variable processing in
>> intl/dcigettext.c was not covered by that fix. An attacker who can
>> set LANGUAGE (e.g. via SSH AcceptEnv) can force any gettext-using
>> program to load a crafted .mo file from an arbitrary filesystem
>> location via directory traversal. A crafted .mo file can crash the
>> program through out-of-range offsets or through format-string
>> translations that consume more arguments than the caller passes,
>> causing undefined behaviour in *printf. glibc cannot fully protect
>> against the latter at the gettext level. The safety of .mo files
>> normally relies on them being produced by msgmerge and msgfmt -c and
>> installed in read-only locations; path traversal bypasses this trust
>> model.
>>
>> Remove the ENABLE_SECURE gate from the IS_PATH_WITH_DIR check so it
>> applies to all binaries, not just SUID/SGID ones, and extend it to
>> also reject the bare ".." entry which contains no directory separator
>> but still names the parent directory.
>>
>> Add tst-gettext-path-traversal to verify that locale names containing
>> path separators or equal to ".." are rejected by the LANGUAGE processing loop.
>>
>> This fixes bug 17142 and CVE-2026-84243.
>>
>> Suggested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>> Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
>
> Given this is a security fix, I am considering backporting it to a few
> stable release branches. As it is a behavioural change affecting
> compatibility, I wonder if this is acceptable. Opinions welcomed.
A lot of security fixes involve behavioral changes.
I think the security team decided that this change is desirable when
they declared it to be a vulnerability. Please proceed with the
backports.
Thanks,
Florian
More information about the Libc-stable
mailing list