Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 18 Nov 2021 20:41:56 +0100
From: Alexander Sosedkin <monk@...oiled.info>
To: Érico Nogueira <ericonr@...root.org>,
 musl@...ts.openwall.com
Subject: Re: $ORIGIN rpath expansion without /proc: code looks wrong

On 11/18/21 20:21, Érico Nogueira wrote:
> On Wed Nov 17, 2021 at 5:01 PM -03, Jeffrey Walton wrote:
>> On Wed, Nov 17, 2021 at 12:09 PM Érico Nogueira <ericonr@...root.org>
>> wrote:
>>>
>>> On Wed Nov 17, 2021 at 11:04 AM -03, Alexander Sosedkin wrote:
>>>> ...
>>>> Could somebody take a look at this and double-check that
>>>> this codepath makes sense?
>>>
>>> It does, but it might not be as robust as you wish. fixup_rpath() treats
>>> the RPATH entry as a single string, and does all $ORIGIN substitutions
>>> in one go (what splits the string by ":" is open_path()). This means
>>> that the entire RPATH entry containing $ORIGIN will be ignored if
>>> /proc/self/exe can't be accessed, despite one or more of them not
>>> depending on $ORIGIN.
>>
>> This has come up before on the list. It is different behavior from
>> libc, and it may be CVE worthy if a down-level library is used when an
>> updated library is available but lost because the RPATH/RUNPATH is
>> discarded.
> 
> I would file such a CVE on the distro packaging or system administration
> rather than musl. The binaries you need to run so /proc is mounted
> shouldn't be the sort that depend on dynamic RPATH using ${ORIGIN}
> (rather than a static one or no RPATH at all), and any security fix
> should be confirmed to actually work before being deployed...

> Furthermore, I don't think an unprivileged user should be able to
> unmount /proc unless they have called prctl(PR_SET_NO_NEW_PRIVS, 1), no?
> Which would make any "attacks" be directed at themselves.

Well, an unprivileged user can bind-mount anything they want over /proc
with user mount namespaces, no problem.

The question would rather be "what gives", because
for non-suid case they seem to gain nothing they can't gain
by supplying their own dynamic loader;
and for suid case we don't resolve $ORIGIN anyway.

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.