Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210905231135.GG13220@brightrain.aerifal.cx>
Date: Sun, 5 Sep 2021 19:11:35 -0400
From: Rich Felker <dalias@...c.org>
To: Sören Tempel <soeren@...ren-tempel.net>
Cc: musl@...ts.openwall.com
Subject: Re: tzset() cannot handle arbitrary inputs

On Sun, Sep 05, 2021 at 11:26:08PM +0200, Sören Tempel wrote:
> Markus Wichmann <nullplan@....net> wrote:
> > Hi all,
> 
> Hi,
> 
> > The user setting TZ is also the one getting the crashes. The
> > assumption is less that the input is always valid, but more that if it
> > is invalid, the user will only be hacking themselves.
> 
> This is only true under the assumption that $TZ itself is never set to a
> value derived from an untrusted source. See the aforementioned calcurse
> code for example where this assumption does not hold. If you search
> GitHub or use codesearch.debian.net you will find plenty additional
> examples where people "abuse" $TZ to query information about zonefiles
> by name. Please also note that these spatial memory safety violations
> are UB and thus might or might not lead to a crash.

There are all sorts of reasons this is a really bad idea, especially
if no filtering on the accepted names is performed. For instance, TZ
strings taken from malicious data files could cause device files with
side effects to be opened (including acquisition of a controlling
tty), or coule potentially leak private data. If applications are
doing this, they really should be ensuring that the string fits a
reasonably "safe" form -- for example, not starting with ./ or / and
not containing .. components, or even more restrictive like just
/[[:alnum:]]+(/[[:alnum:]]+)?/

I think we could and should do some basic things on the musl side to
ensure at least memory safety (bounding all accesses within the mapped
region) but as long as we're using mmap on systems that lack MAP_COPY,
that's about the limit of what can be done. And I want to approach
this topic with some care not to give the impression that, after
changes are made, it will be "safe" to use untrusted zone files.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.