public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Carlos O'Donell <carlos@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Andreas Schwab <schwab@suse.de>,
	"Dmitry V. Levin" <ldv@altlinux.org>
Subject: Re: [PATCH v4] Improve DST handling (Bug 23102, Bug 21942, Bug 18018, Bug, 23259, CVE-2011-0536 ).
Date: Mon, 11 Jun 2018 07:28:00 -0000	[thread overview]
Message-ID: <2ca2dfa9-2066-9cfb-9851-6dc8415b1085@redhat.com> (raw)
In-Reply-To: <a98a01e8-7358-b848-6778-5bdf21d633be@redhat.com>

On 06/11/2018 04:54 AM, Carlos O'Donell wrote:
>>> I consider the following valid:
>>>
>>> [$ORIGIN/../$LIB]
>> I'm actually asking about this:
>>
>> [$LIB:$ORIGIN/../$LIB]
>>
>> Doesn't the current code reject this?
> The current code does not reject this. In fact it accepts $LIB in RPATH
> et. al. because there is no code to reject it. Only $ORIGIN has any
> restrictions.

I meant the $ORIGN part.  As far as I understand it, start will not be 
close to input for the second part containing origin (after the :), so 
this check in _dl_dst_substitute should reject it:

		      || (input != start + 1
			  || (input > start + 2 && input[-2] != ':'))))

I'm not sure that this is right.

> Should all paths get tested for trusted paths for a SUID/SGID binary?
> It seems like that's the right idea.
> 
> @@ -365,7 +383,8 @@ _dl_dst_substitute (struct link_map *l, const char *start,
>  
>    /* In SUID/SGID programs, after DST expansion the normalized
>       path must be rooted in one of the trusted directories.  */
> -  if (__glibc_unlikely (check_for_trusted)
> +  if (__glibc_unlikely (__libc_enable_secure)
> +      && l->l_type == lt_executable
>        && !is_trusted_path_normalize (result, wp - result))
>      {
>        *result = '\0';
> 
> Just drop check_for_trusted, and execute the is_trusted_path_normalize
> check for all SUID/SGID paths?

No, $ORIGIN in a trusted path is itself trusted (because you cannot 
manipulate it using hard links).  I think there are installations out 
there which depend on this.

Thanks,
Florian

  reply	other threads:[~2018-06-11  7:28 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  5:03 [PATCH] " Carlos O'Donell
2018-06-06 14:01 ` Florian Weimer
2018-06-06 14:55   ` Carlos O'Donell
2018-06-06 14:17 ` Florian Weimer
2018-06-06 15:59   ` Carlos O'Donell
2018-06-06 15:47 ` Andreas Schwab
2018-06-06 16:01   ` Carlos O'Donell
2018-06-06 16:10 ` Carlos O'Donell
2018-06-06 16:31   ` Andreas Schwab
2018-06-06 17:10     ` Carlos O'Donell
2018-06-06 17:28       ` Florian Weimer
2018-06-06 18:49         ` Carlos O'Donell
2018-06-06 18:56           ` Florian Weimer
2018-06-06 20:04             ` Carlos O'Donell
2018-06-07  6:49       ` Andreas Schwab
2018-06-08  2:08         ` Carlos O'Donell
2018-06-11  8:04           ` Andreas Schwab
2018-06-12  3:08             ` Carlos O'Donell
2018-06-12  7:31               ` Andreas Schwab
2018-06-12 12:46                 ` Carlos O'Donell
2018-06-12 13:02                   ` Andreas Schwab
2018-06-12 13:03                     ` Carlos O'Donell
2018-06-06 20:19   ` Carlos O'Donell
2018-06-07 11:38     ` Florian Weimer
2018-06-08  2:14       ` Carlos O'Donell
2018-06-07 12:16     ` Florian Weimer
2018-06-08  4:15       ` Carlos O'Donell
2018-06-08  5:21         ` Florian Weimer
2018-06-08  5:46           ` Carlos O'Donell
2018-06-08  5:50             ` Carlos O'Donell
2018-06-07 12:43     ` Florian Weimer
2018-06-08  5:37       ` Carlos O'Donell
2018-06-08  5:45     ` [PATCH v4] " Carlos O'Donell
2018-06-08  5:51       ` Florian Weimer
2018-06-08  6:03         ` Carlos O'Donell
2018-06-08  6:25           ` Florian Weimer
2018-06-11  2:55             ` Carlos O'Donell
2018-06-11  7:28               ` Florian Weimer [this message]
2018-06-11 14:44                 ` Carlos O'Donell
2018-06-12  3:46       ` Carlos O'Donell
2018-06-12 13:08         ` [PATCH v6] " Carlos O'Donell
2018-06-12 13:20           ` Andreas Schwab
2018-06-12 13:23             ` Andreas Schwab
2018-06-12 14:10               ` Carlos O'Donell
2018-06-12 14:34                 ` Andreas Schwab
2018-06-12 14:31           ` Florian Weimer
2018-06-12 14:36             ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ca2dfa9-2066-9cfb-9851-6dc8415b1085@redhat.com \
    --to=fweimer@redhat.com \
    --cc=carlos@redhat.com \
    --cc=ldv@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).